Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

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!

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.dart

The 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