Skip to content

arturdm/design_patterns_in_dart

Repository files navigation

Design patterns (GoF) using Dart language

Build Status

This repository contains sample implementations of GoF design patterns in Dart.

Inspired by https://github.com/dbacinski/Design-Patterns-In-Kotlin.

Table of contents

Creational design patterns

Abstract Factory

Still have to find a way to print some object it pointed by a reference.

See code example

Prototype

There is a nice way of creating objects with a named constructor just like with static factory methods in Java.

See code example

Builder

There is no support for inner classes.

See code example

Factory Method

This one can be done using factory constructor.

See code example

Singleton

This singleton implementation utilizes lazy loading of global variables. There is also a way of implementing a singleton with a factory constructor that always returns the same instance.

See code example

Structural design patterns

Adapter

Provides a link between two incompatible types by wrapping one type with a class that supports the interface required by the client.

See code example

Bridge

See code example

Composite

See code example

Decorator

See code example

Facade

See code example

Flyweight

See code example

Proxy

See code example

Behavioural design patterns

Chain Of Responsibility

See code example

Command

Used to express a request including the call to be made and the required parameters in a command object. It may then be executed immediately or held for later use.

See code example

Interpreter

Used to define the grammar for instructions that form part of a language or notation, whilst allowing the grammar to be easily extended.

See code example

Iterator

Mediator

Memento

The memento pattern is used to capture the current state of an object and store it in such a manner that it can be restored at a later time without breaking the rules of encapsulation.

See code example

Observer

The observer pattern is used to allow an object to publish changes to its state. Other objects subscribe to be immediately notified of any changes.

See code example

State

Strategy

See code example

Template Method

The template method pattern is used to define the basic steps of an algorithm and allow the implementation of the individual steps to be changed.

See code example

Visitor

Releases

No releases published

Packages

No packages published

Languages