An architectural design pattern for the Flutter framework.
BRUT is an architectural design pattern that uses BLoC to create an architecture featuring:
Separation of models, logic and view A firm and consistent directory structure that is easy to understand Treatment of models and data providers as microservices separate from the main application Abstraction of data repositories, allowing modular backend implementation
The goal is to allow you to employ clean architecture in Flutter, simplifying code separation into independent layers. These rules will ensure that your project is scalable, easy to read, and consistent while maintaining simplicity.
Based on
BRUT is based on bloc for stream-based state-management, formz for form representation input and equatable.
- Intermediate knowledge of Flutter, streams and BLoC
- (For the BRUT CLI) Mason CLI installed on your system
If you doubt how bloc works, I recommend this article.
The general directory structure of a BRUT app looks similar to this:
my_flutter_app/
├─ lib/
│ ├─ features/
│ │ ├─ app/
│ │ ├─ authentication/
│ │ ├─ profile_creation/
│ ├─ l10n/
│ ├─ plugins/
│ ├─ main_development.dart/
│ ├─ main_staging.dart/
│ ├─ main_production.dart/
├─ packages/
│ ├─ my_flutter_authentication/
│ ├─ my_flutter_theme/
├─ pubspec.yaml
- /lib/features contains folders each representing a feature (eg. /profile_creation/)
- /packages/ has Flutter or Dart modules as either a widget library (/my_flutter_theme/) or a domain of models and data repositories (/my_flutter_authentication/).
You can use the cli to quickly create features or packages.