GitHunt
OM

omegaui/design-patterns

Quick-reference guide to software design patterns with concise Dart examples.

โšก Design Patterns under 1 min

Quick-reference guide to software design patterns with concise Dart examples.

Dart 27 patterns Concise

๐Ÿ—๏ธ Creational

All about object instantiation.

Pattern Description
๐Ÿญ Abstract Factory Create families of related objects based on context
๐Ÿงฑ Builder Construct complex objects step by step
๐Ÿ”จ Factory Method Let subclasses decide which class to instantiate
โ™ป๏ธ Object Pool Reuse expensive objects instead of recreating them
๐Ÿ‘ Prototype Clone existing objects instead of building from scratch
1๏ธโƒฃ Singleton Ensure a class has only one instance

๐Ÿงฉ Structural

All about composing classes and objects.

Pattern Description
๐Ÿ”Œ Adapter Make incompatible interfaces work together
๐ŸŒ‰ Bridge Decouple abstraction from implementation
๐ŸŒณ Composite Treat individual objects and groups uniformly
๐ŸŽ€ Decorator Add behavior dynamically without subclassing
๐Ÿ›๏ธ Facade Simplify a complex subsystem with one interface
๐Ÿชถ Flyweight Share common state to save memory
๐Ÿ“ฆ Module Encapsulate code with controlled public API
๐Ÿ”’ Private Class Data Restrict write access to class attributes
๐Ÿ›ก๏ธ Proxy Control access via a surrogate object

๐ŸŽญ Behavioral

All about communication between objects.

Pattern Description
โ›“๏ธ Chain of Responsibility Pass requests along a handler chain
๐Ÿ“ Command Encapsulate actions as objects with undo support
๐Ÿ”ค Interpreter Evaluate sentences in a language grammar
๐Ÿ”„ Iterator Access collection elements sequentially
๐Ÿ“ก Mediator Centralize complex communication between objects
๐Ÿ’พ Memento Capture and restore object state
๐Ÿšซ Null Object Provide a do-nothing default to eliminate null checks
๐Ÿ‘€ Observer Notify dependents when state changes
๐Ÿ”€ State Change behavior when internal state changes
๐ŸŽฏ Strategy Swap algorithms at runtime
๐Ÿ“‹ Template Method Define algorithm skeleton, let subclasses fill in steps
๐Ÿšถ Visitor Add operations to classes without modifying them