Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/scottt2/design-patterns-in-dart
Gang of Four (GOF) design patterns implemented in Dart. Contributions welcome!
https://github.com/scottt2/design-patterns-in-dart
dart dart2 dartlang design gang-of-four gof gof-patterns patterns patterns-design
Last synced: about 1 month ago
JSON representation
Gang of Four (GOF) design patterns implemented in Dart. Contributions welcome!
- Host: GitHub
- URL: https://github.com/scottt2/design-patterns-in-dart
- Owner: scottt2
- License: mit
- Created: 2019-06-10T23:14:28.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2024-02-05T21:32:48.000Z (7 months ago)
- Last Synced: 2024-07-09T01:24:09.938Z (2 months ago)
- Topics: dart, dart2, dartlang, design, gang-of-four, gof, gof-patterns, patterns, patterns-design
- Language: Dart
- Homepage: https://scottt2.github.io/design-patterns-in-dart/
- Size: 63.5 KB
- Stars: 450
- Watchers: 19
- Forks: 110
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Design Patterns in Dart
Welcome! The intent of this repo is to provide
1. Examples for each of the [23 Gang of Four design patterns](https://en.wikipedia.org/wiki/Design_Patterns)
2. An introduction to the [Dart programming language](https://dart.dev/)Please see [Getting Started](#getting-started) for more information on how to run the examples.
## Table of Contents
### Behavioral Patterns
* [x] [Chain of Responsibility](https://github.com/scottt2/design-patterns-in-dart/tree/master/chain_of_responsibility)
* [x] [Command](https://github.com/scottt2/design-patterns-in-dart/tree/master/command)
* [x] [Interpreter](https://github.com/scottt2/design-patterns-in-dart/tree/master/interpreter)
* [x] [Iterator](https://github.com/scottt2/design-patterns-in-dart/tree/master/iterator)
* [x] [Mediator](https://github.com/scottt2/design-patterns-in-dart/tree/master/mediator)
* [x] [Memento](https://github.com/scottt2/design-patterns-in-dart/tree/master/memento)
* [x] [Observer](https://github.com/scottt2/design-patterns-in-dart/tree/master/observer)
* [x] [State](https://github.com/scottt2/design-patterns-in-dart/tree/master/state)
* [x] [Strategy](https://github.com/scottt2/design-patterns-in-dart/tree/master/strategy)
* [x] [Template Method](https://github.com/scottt2/design-patterns-in-dart/tree/master/template_method)
* [x] [Visitor](https://github.com/scottt2/design-patterns-in-dart/tree/master/visitor)### Creational
* [x] [Abstract Factory](https://github.com/scottt2/design-patterns-in-dart/tree/master/abstract_factory)
* [x] [Builder](https://github.com/scottt2/design-patterns-in-dart/tree/master/builder)
* [x] [Factory Method](https://github.com/scottt2/design-patterns-in-dart/tree/master/factory_method)
* [x] [Prototype](https://github.com/scottt2/design-patterns-in-dart/tree/master/prototype)
* [x] [Singleton](https://github.com/scottt2/design-patterns-in-dart/tree/master/singleton)### Structural Patterns
* [x] [Adapter](https://github.com/scottt2/design-patterns-in-dart/tree/master/adapter)
* [x] [Bridge](https://github.com/scottt2/design-patterns-in-dart/tree/master/bridge)
* [x] [Composite](https://github.com/scottt2/design-patterns-in-dart/tree/master/composite)
* [x] [Decorator](https://github.com/scottt2/design-patterns-in-dart/tree/master/decorator)
* [x] [Facade](https://github.com/scottt2/design-patterns-in-dart/tree/master/facade)
* [x] [Flyweight](https://github.com/scottt2/design-patterns-in-dart/tree/master/flyweight)
* [x] [Proxy](https://github.com/scottt2/design-patterns-in-dart/tree/master/proxy)## Getting Started
Each example has its own directory, inside which is a short readme and a sole Dart file.
To run the example, make sure you [have Dart installed](https://dart.dev/get-dart) and then just do
```
dart /.dart
```
Take [State](https://github.com/scottt2/design-patterns-in-dart/tree/master/state), for example:
```
> dart state/state.dartThe light switch is off.
Toggling the light switch...
Touching the Stateful...
Handler of StatusOff is being called!
The light switch is on.
```If you have any questions or see any issues, please feel free to [file an issue](https://github.com/scottt2/design-patterns-in-dart/issues/new).
Enjoy!
-Tyler