A comprehensive collection of Flutter projects demonstrating four different architecture patterns for building scalable and maintainable applications. All patterns implement identical features and UI for easy comparison.
📁 mvc_architeture_pattern/
Pattern Overview:
- Model: Data and business logic
- View: UI components
- Controller: Mediates between Model and View
Best For: Small to medium apps, rapid prototyping, learning Flutter basics
Features:
- ✅ Counter with increment/decrement/reset
- ✅ Notes with add/view/delete
- ✅ Theme toggle (dark/light)
- ✅ Home view with navigation
- ✅ Persistent storage with GetStorage
Complexity: ⭐ Simple | Files: ~10 | Lines: ~800
📁 mvvm_architeture_pattern/
Pattern Overview:
- Model: Data entities
- View: UI components
- ViewModel: Presentation logic with observables
Best For: Medium to large apps, complex UI state, reactive programming
Features:
- ✅ Counter with increment/decrement/reset
- ✅ Notes with add/view/delete
- ✅ Theme toggle (dark/light)
- ✅ Home view with navigation
- ✅ Persistent storage with GetStorage
Complexity: ⭐⭐ Moderate | Files: ~15 | Lines: ~1,000
📁 clean_architeture_pattern/
Pattern Overview:
- Data Layer: Repositories, data sources, models
- Domain Layer: Use cases, entities, repository interfaces
- Presentation Layer: Controllers, views, bindings
Best For: Large scalable apps, multiple teams, high testability requirements
Features:
- ✅ Counter with increment/decrement/reset
- ✅ Notes with add/view/delete
- ✅ Theme toggle (dark/light)
- ✅ Home view with navigation
- ✅ Persistent storage with GetStorage
- ✅ Framework-independent domain layer
Complexity: ⭐⭐⭐ Complex | Files: ~25 | Lines: ~1,500
📁 ddd_architeture_pattern/
Pattern Overview:
- Domain Layer: Entities, value objects, repository interfaces (pure Dart)
- Application Layer: Use cases orchestrating domain logic
- Infrastructure Layer: DTOs, data sources, repository implementations
- Presentation Layer: Controllers, views, bindings
Best For: Enterprise applications, complex business logic, evolving requirements
Features:
- ✅ Counter with increment/decrement/reset
- ✅ Notes with add/view/delete
- ✅ Theme toggle (dark/light)
- ✅ Home view with navigation
- ✅ Persistent storage with GetStorage
- ✅ Pure domain layer (zero Flutter dependencies)
- ✅ Value objects with validation
- ✅ Rich domain models with behavior
Complexity: ⭐⭐⭐⭐ Most Complex | Files: ~40 | Lines: ~2,500
This repository provides TWO complete implementations of each pattern:
- State Management: BLoC/Cubit with flutter_bloc
- Persistence: HydratedBloc
- Approach: Stream-based reactive programming
- Best For: Large teams, strict architecture, high testability
- State Management: GetX Controllers
- Persistence: GetStorage
- Approach: Observer pattern with reactive variables
- Best For: Rapid development, smaller teams, simpler syntax
See: STATE_MANAGEMENT_COMPARISON.md for comprehensive comparison
- 📊 Quick comparison & decision guide
- 🏗️ Architecture deep dive (how they work)
- 💻 Side-by-side code examples
- ⚡ Performance benchmarks
- 👨💻 Developer experience comparison
- 🔄 Migration guides
All four patterns implement identical features with consistent UI/UX:
- Same Counter and Notes functionality
- Identical home view design
- Consistent theme toggle
- Uniform styling and layouts
This allows you to:
- 🔍 Compare architectures side-by-side
- 📚 Learn pattern differences without UI distractions
- 🎯 Choose the right pattern for your project
- 💡 Understand trade-offs clearly
- STATE_MANAGEMENT_COMPARISON.md - BLoC vs GetX comparison (7 focused guides) ⭐ NEW STRUCTURE
- 01: Overview & Quick Comparison (5 min)
- 02: How They Work (10 min)
- 03: Architecture Integration (15 min)
- 04: Performance & Benchmarks (8 min)
- 05: Developer Experience (12 min)
- 06: Decision Guide (7 min)
- 07: Migration Guide (10 min)
- STANDARDIZATION_SUMMARY.md - Complete standardization details
- COMPARISON_GUIDE.md - In-depth pattern comparison
- Each project has detailed README and code comments
- Clean, maintainable code
- Best practices implementation
- Zero compilation errors
- Dual state management (BLoC & GetX)
- Proper error handling
- Flutter SDK (3.9.2 or higher)
- Dart SDK (3.9.2 or higher)
- VS Code or Android Studio (recommended)
-
Clone this repository:
git clone https://github.com/YoussefSalem582/flutter_architecture_patterns.git cd flutter_architecture_patterns -
Choose a pattern and navigate to it:
# For MVC cd mvc_architeture_pattern # For MVVM cd mvvm_architeture_pattern # For Clean Architecture cd clean_architeture_pattern # For DDD cd ddd_architeture_pattern
-
Install dependencies:
flutter pub get
-
Run the app:
flutter run # Or run on specific device flutter run -d chrome flutter run -d windows
- Understand basic separation of concerns
- Learn Model-View-Controller fundamentals
- Build simple apps quickly
- Start Here if new to Flutter architecture
- Learn reactive programming with GetX
- Understand ViewModel pattern
- Master observable state management
- Choose This for UI-heavy apps
- Understand layered architecture
- Learn use case pattern
- Master dependency inversion
- Choose This for large-scale apps
- Master tactical DDD patterns
- Understand value objects and entities
- Learn bounded contexts
- Choose This for enterprise apps
| Feature | MVC | MVVM | Clean | DDD |
|---|---|---|---|---|
| Layers | 3 | 3 | 3 | 4 |
| Complexity | Simple | Moderate | Complex | Most Complex |
| Learning Curve | Easy | Moderate | Hard | Very Hard |
| Files | ~10 | ~15 | ~25 | ~40 |
| Best For | Small apps | Medium apps | Large apps | Enterprise |
| Testability | Moderate | Good | Excellent | Best |
| Feature | BLoC | GetX |
|---|---|---|
| Learning Curve | Steep (3-6 months) | Easy (1 month) |
| Code Amount | More (Verbose) | Less (64% reduction) |
| Performance | Excellent ⚡⚡⚡⚡⚡ | Excellent ⚡⚡⚡⚡⚡ |
| Memory Usage | Lower (~68 MB) | Slightly Higher (~72 MB) |
| Testability | Excellent (blocTest) | Good |
| Boilerplate | High | Low |
| Type Safety | Excellent | Good |
| DI & Routing | External packages | Built-in |
| Best For | Large teams, complex state | Rapid development, MVPs |
See STATE_MANAGEMENT_COMPARISON.md for detailed analysis.
- Landing page with navigation
- Architecture information card
- Feature cards for Counter and Notes
- Theme toggle button
- Increment counter (+1)
- Decrement counter (-1)
- Reset counter (to 0)
- Persistent storage
- Reactive UI updates
- Add new notes
- View all notes
- Delete individual notes
- Delete all notes
- Timestamps on each note
- Empty state handling
- Persistent storage
- Light theme (default)
- Dark theme
- System theme (MVVM, Clean, DDD)
- Theme toggle button in app bar
mvc_architeture_pattern/
├── lib/
│ ├── models/ # Data models
│ ├── views/ # UI screens
│ ├── controllers/ # Business logic
│ └── main.dart
mvvm_architeture_pattern/
├── lib/
│ ├── models/ # Data entities
│ ├── views/ # UI screens
│ ├── viewmodels/ # Presentation logic
│ ├── bindings/ # Dependency injection
│ ├── routes/ # Navigation
│ └── main.dart
clean_architeture_pattern/
├── lib/
│ ├── core/ # Shared resources
│ ├── features/
│ │ ├── counter/
│ │ │ ├── data/ # Data layer
│ │ │ ├── domain/ # Domain layer
│ │ │ └── presentation/ # Presentation layer
│ │ └── notes/
│ └── main.dart
ddd_architeture_pattern/
├── lib/
│ ├── domain/ # Pure business logic
│ ├── application/ # Use cases
│ ├── infrastructure/ # Implementation
│ ├── presentation/ # UI layer
│ └── main.dart
-
📘 GETTING_STARTED.md - Complete setup guide for beginners
- Prerequisites and installation (Windows/macOS/Linux)
- Running apps on different platforms
- Feature testing checklist
- Common issues and solutions
- Next steps and learning progression
-
📗 BEST_PRACTICES.md - Professional coding standards
- General Flutter best practices
- Pattern-specific best practices (MVC, MVVM, Clean, DDD)
- GetX state management guidelines
- Code organization and naming conventions
- Testing strategies
- Performance optimization
- Security best practices
-
📕 TROUBLESHOOTING.md - Problem-solving guide
- Installation issues
- Build errors (Android, iOS, Windows, Web)
- Runtime errors
- Platform-specific issues
- State management problems
- Navigation and storage issues
- Performance troubleshooting
-
📙 LEARNING_RESOURCES.md - Curated learning materials
- Official documentation links
- Architecture pattern resources
- Video tutorials and YouTube channels
- Recommended books
- Online courses (Udemy, Coursera, free options)
- Community resources (Discord, Reddit, Stack Overflow)
- Practice project ideas
- Month-by-month learning path
-
STANDARDIZATION_SUMMARY.md - How patterns were standardized
- Feature comparison across patterns
- UI/UX consistency details
- Screen-by-screen breakdown
- Benefits of standardization
-
COMPARISON_GUIDE.md - In-depth pattern comparison
- Side-by-side code examples
- Architecture layer explanations
- Testability comparison
- Performance metrics
- Decision matrix for pattern selection
mvc_architeture_pattern/README.md- MVC pattern explanation and setup- Simple structure with clear examples
mvvm_architeture_pattern/README.md- MVVM pattern guide- Reactive programming examples
- GetX integration details
clean_architeture_pattern/README.md- Clean Architecture overview- Layer separation details
- Use case examples
ddd_architeture_pattern/README.md- DDD pattern introductionddd_architeture_pattern/tech_readme_files/- Advanced DDD documentation:ARCHITECTURE.md- Complete architecture breakdownDDD_CONCEPTS.md- Domain-Driven Design conceptsPROJECT_OVERVIEW.dart- Code-level overviewQUICK_START.md- Quick start guide for DDDFIXES_APPLIED.md- Implementation fixes and improvements
For Beginners:
- Start with GETTING_STARTED.md - Set up your environment
- Read README.md (this file) - Understand the patterns
- Follow the Learning Path section - Week-by-week progression
- Explore MVC pattern first - Simplest to understand
- Refer to TROUBLESHOOTING.md when needed
For Experienced Developers:
- Review COMPARISON_GUIDE.md - Compare all patterns quickly
- Check BEST_PRACTICES.md - Ensure code quality
- Dive into specific patterns based on your needs
- Read LEARNING_RESOURCES.md for advanced topics
For Team Leads/Architects:
- Study COMPARISON_GUIDE.md - Make informed decisions
- Review STANDARDIZATION_SUMMARY.md - Understand consistency approach
- Read pattern-specific READMEs for implementation details
- Check DDD tech_readme_files/ for enterprise architecture
- ✅ Building small apps (< 5 screens)
- ✅ Rapid prototyping
- ✅ Learning Flutter
- ✅ Personal projects
- ✅ Medium-sized apps (5-15 screens)
- ✅ Complex UI state
- ✅ Reactive programming preferred
- ✅ Two-way data binding needed
- ✅ Large apps (15+ screens)
- ✅ Multiple developers
- ✅ High testability required
- ✅ Long-term maintenance
- ✅ Enterprise applications
- ✅ Complex business logic
- ✅ Multiple bounded contexts
- ✅ Domain experts involved
- ✅ Evolving requirements
All patterns are designed to be testable:
- MVC: Controller testing
- MVVM: ViewModel testing
- Clean: Layer-by-layer testing
- DDD: Pure domain testing + all layers
Run tests:
flutter test- Flutter: 3.9.2+
- Dart: 3.9.2+
- flutter_bloc: 8.1.3 (State management)
- hydrated_bloc: 9.1.2 (State persistence)
- bloc: 8.1.2 (Core BLoC library)
- shared_preferences: 2.2.2 (Local storage)
- equatable: 2.0.5 (Value equality)
- dartz: 0.10.1 (Functional programming - Clean & DDD only)
- get: 4.6.6 (State management, routing, DI)
- get_storage: 2.1.1 (Local persistence)
- equatable: 2.0.5 (Value equality)
- dartz: 0.10.1 (Functional programming - Clean & DDD only)
- uuid: 4.2.1 (Unique identifiers - DDD only)
- cupertino_icons: 1.0.8 (iOS-style icons)
- path_provider: 2.1.1 (File paths - BLoC only)
If this repository helped you learn Flutter architecture patterns, please give it a ⭐ star!
Share it with others who might find it useful!
This project is for educational purposes. Feel free to use it for learning and reference.
By working through this repository, you will:
✅ Master 4 Architecture Patterns - MVC, MVVM, Clean Architecture, DDD ✅ Understand Trade-offs - Know when to use each pattern ✅ Learn Best Practices - Professional coding standards ✅ Build Scalable Apps - Structure code for growth ✅ Write Testable Code - Unit, widget, and integration tests ✅ Use Modern Tools - GetX state management and more ✅ Make Informed Decisions - Choose the right pattern for your project
- Start Learning: GETTING_STARTED.md
- Best Practices: BEST_PRACTICES.md
- Troubleshooting: TROUBLESHOOTING.md
- Resources: LEARNING_RESOURCES.md
- Architecture Pattern Comparison: COMPARISON_GUIDE.md
- State Management Comparison: STATE_MANAGEMENT_COMPARISON.md ⭐ REORGANIZED
- 7 focused documents for easier learning
- Reading time: 5-15 min per document
- Multiple learning paths (beginner/intermediate/expert)
- Standardization Details: STANDARDIZATION_SUMMARY.md
Happy Learning! 🚀 Master Flutter Architecture Patterns!