https://github.com/sakibvhossain/flutter_clean_architecture
https://github.com/sakibvhossain/flutter_clean_architecture
Last synced: 3 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/sakibvhossain/flutter_clean_architecture
- Owner: SakibvHossain
- Created: 2024-10-29T05:44:38.000Z (7 months ago)
- Default Branch: main
- Last Pushed: 2025-01-03T09:50:54.000Z (5 months ago)
- Last Synced: 2025-01-03T10:30:13.498Z (5 months ago)
- Size: 85 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Flutter
# Clean Architecture vs Hybrid Modular Approach Folder Structure
This document provides a recommended folder structure for implementing Clean Architecture in a Flutter application. Clean Architecture helps maintain separation of concerns, making code easier to test, maintain, and scale.
## Folder Structure for Hybrid Modular Approach
```plaintext
└──T-Store/
└──lib/
├── common/
│ ├── styles
│ ├── widgets
├── controller
├── data/
│ └── models
│ ├── model
│ ├── repositories
│ ├── services
├── localization
├── screens
├── util/
│ ├── constants
│ ├── devices
│ ├── formatters
│ ├── helpers
│ └── theme
├── app.dart
└── main.dart
```
## Folder Structure for Clean Architecture
```plaintext
lib/
├── data/ # Data sources, such as API clients, local data sources
│ ├── models/
│ ├── repositories/
│ └── sources/
├── domain/ # Core business logic, entities, and use cases
│ ├── entities/
│ └── use_cases/
├── presentation/ # UI and presentation logic (e.g., blocs, controllers)
│ ├── widgets/
│ └── screens/
└── main.dart
```# Hybrid Modular Approach vs. Clean Architecture
| **Aspect** | **Hybrid Modular Approach** | **Clean Architecture** |
|-------------------------|----------------------------------------------------------|----------------------------------------------|
| **Primary Focus** | Modular organization by feature or functional components | Separation of concerns, clear dependency rules |
| **Structure** | Feature/function-based folders (e.g., screens, data, util) | Layer-based folders (e.g., data, domain, presentation) |
| **Dependencies** | Allows flexibility, modules can reference each other freely | Inner layers can’t depend on outer layers |
| **Flexibility** | High flexibility, adaptable for various app sizes | Structured and rigid, suitable for large, scalable apps |
| **Best for** | Small to medium apps, teams looking for quick navigation | Large apps, teams with strict requirements for maintainability |
| **Pros** | - Easy navigation
- Quick to set up
- Great for smaller teams | - High maintainability
- Great for testing and scalability
- Clear layer boundaries |
| **Cons** | - Risk of tangled dependencies as the app grows
- Limited structure for larger projects | - Complex setup for small projects
- Requires strict adherence to rules and structure |