Domain-Driven Bloc
A Flutter Project Blueprint for Building Maintainable and Scalable Flutter Apps.
Credits
This project was originally developed by Very Good Ventures 🦄
It has been forked and adapted for creating different app templates with a clean architecture based on domain driven design
This fork is not officially maintained or affiliated with Very Good Ventures.
Getting Started 🚀
This app template can be generated using mason_cli with customized variables.
Ensure you have mason_cli installed.
# Activate mason_cli from https://pub.dev
dart pub global activate mason_cli
# Or install from https://brew.sh
brew tap felangel/mason
brew install mason
Installation
# Install locally
mason add domain_driven_bloc
# Or install globally
mason add -g domain_driven_bloc
Usage 🚀
# Generate the domain_driven_bloc app template
mason make domain_driven_bloc
What's Included ✨
Out of the box, Domain-Driven Bloc includes:
- ✅ Cross Platform Support - Built-in support for iOS, Android, Web, and Windows (MacOS/Linux coming soon!)
- ✅ Build Flavors - Multiple flavor support for development, staging, and production
- ✅ Internationalization Support - Internationalization support using synthetic code generation to streamline the development process
- ✅ Sound Null-Safety - No more null-dereference exceptions at runtime. Develop with a sound, static type system.
- ✅ Bloc - Integrated bloc architecture for scalable, testable code which offers a clear separation between business logic and presentation
- ✅ Testing - Unit and Widget(Golden) Tests with more than 80% line coverage
- ✅ Logging - Built-in, extensible logging to capture uncaught Flutter and Dart Exceptions
- ✅ Continuous Integration - Lint, format, test, and enforce code coverage using GitHub Actions
- ✅ Dependabot Integration - Automated dependency updates built into GitHub
- ✅ Flutter Version Management - A simple CLI to manage Flutter SDK versions.
- ✅ Makefile - A simple way to organize and standardize project commands
Additional Packages
State Management
✅ Flutter Bloc
✅ Flutter Hooks
Functional Programming
✅ Fpdart
Data Classes
Navigation
Dependency Injection
✅ Injectable
✅ Get It
Responsive
Environment Variable Management
✅ Dotenv
HTTP Client
✅ Chopper
Local Storage
✅ Secure Storage
✅ Shared Preferences
Security
Logging
✅ Logger
✅ Pretty Chopper Logger
Localization
✅ Intl
✅ Intl Utils
Package & Device Info
✅ Package Info Plus
✅ Device Info Plus
Assets
Testing
✅ Alchemist
✅ Golden Toolkit
✅ Bloc Test
Mock
✅ Mockito
✅ Mocktail Image Network
✅ Faker
Code Quality
✅ Very Good Analysis
✅ Dependency Validator
Output📦
Features ⭐
- ✴️ Domain-Driven-Bloc - A clean architecture based on domain driven design
- ✴️ Authentication - A mock authentication implementation using Reqres API (e.g. Email: [email protected], Password: password ).
- ✴️ Home - Displays the post found in the sub-reddit FlutterDev.
- ✴️ Profile - Displays the basic information of the mocked user.
- ✴️ Dark Mode - Switch between Light and Dark themes
- ✴️ Unit Testing - Performs a unit test to verify the correctness of a unit of logic under the Bloc and repository layers
- ✴️ Widget(Goldens) Testing - Performs a widget tests that uses a special matcher that compares your widget with an image file and expects that it looks the same
Architecture Diagram
Folder Structure 📁
├── .github
│ ├── PULL_REQUEST_TEMPLATE.md
│ ├── dependabot.yaml
│ └── workflows
│ └── main.yaml
├── .idea
│ └── runConfigurations
│ ├── development.xml
│ ├── production.xml
│ └── staging.xml
├── .vscode
│ ├── extensions.json
│ └── launch.json
├── android
├── assets
│ ├── env
│ ├── fonts
│ ├── icons
│ ├── images
│ └── l10n
│ └── app_en.arb
├── ios
├── lib
│ ├── app
│ │ ├── config
│ │ ├── constants
│ │ ├── generated
│ │ ├── helpers
│ │ │ ├── converters
│ │ │ ├── extensions
│ │ │ └── injection
│ │ ├── observers
│ │ ├── routes
│ │ ├── themes
│ │ ├── utils
│ │ └── app.dart
│ ├── core
│ │ ├── data
│ │ │ ├── dto
│ │ │ ├── repository
│ │ │ └── service
│ │ ├── domain
│ │ │ ├── bloc
│ │ │ ├── interface
│ │ │ └── entity
│ │ └── presentation
│ │ ├── views
│ │ └── widgets
│ ├── features
│ │ ├── auth
│ │ │ ├── data
│ │ │ │ ├── dto
│ │ │ │ ├── repository
│ │ │ │ └── service
│ │ │ ├── domain
│ │ │ │ ├── bloc
│ │ │ │ ├── interface
│ │ │ │ └── entity
│ │ │ └── presentation
│ │ │ ├── views
│ │ │ └── widgets
│ │ ├── home
│ │ │ ├── data
│ │ │ │ ├── dto
│ │ │ │ ├── repository
│ │ │ │ └── service
│ │ │ ├── domain
│ │ │ │ ├── bloc
│ │ │ │ ├── interface
│ │ │ │ └── entity
│ │ │ └── presentation
│ │ │ ├── views
│ │ │ └── widgets
│ │ └── profile
│ │ ├── data
│ │ │ ├── dto
│ │ │ ├── repository
│ │ │ └── service
│ │ ├── domain
│ │ │ ├── bloc
│ │ │ ├── interface
│ │ │ └── entity
│ │ └── presentation
│ │ ├── views
│ │ └── widgets
│ ├── bootstrap.dart
│ ├── main_development.dart
│ ├── main_production.dart
│ └── main_staging.dart
├── test
│ ├── utils
│ ├── unit
│ │ ├── core
│ │ │ ├── bloc
│ │ │ └── repository
│ │ │ ├── auth
│ │ │ └── home
│ │ └── features
│ │ ├── auth
│ │ ├── bloc
│ │ └── repository
│ │ └── home
│ │ ├── bloc
│ │ └── repository
│ ├── widget
│ │ ├── core
│ │ │ ├── views
│ │ │ │ ├── goldens(generated)
│ │ │ │ └── failures(generated)
│ │ │ └── widgets
│ │ │ ├── goldens(generated)
│ │ │ └── failures(generated)
│ │ └── features
│ │ ├── auth
│ │ │ ├── views
│ │ │ │ ├── goldens(generated)
│ │ │ │ └── failures(generated)
│ │ │ └── widgets
│ │ │ ├── goldens(generated)
│ │ │ └── failures(generated)
│ │ ├── home
│ │ │ ├── views
│ │ │ │ ├── goldens(generated)
│ │ │ │ └── failures(generated)
│ │ │ └── widgets
│ │ │ ├── goldens(generated)
│ │ │ └── failures(generated)
│ │ └── profile
│ │ ├── views
│ │ │ ├── goldens(generated)
│ │ │ └── failures(generated)
│ │ └── widgets
│ │ ├── goldens(generated)
│ │ └── failures(generated)
│ └── flutter_test_config.dart
├── web
├── .gitignore
├── analysis_options.yaml
├── coverage_badge.svg
├── LICENSE
├── Makefile
├── pubspec.lock
├── pubspec.yaml
└── README.md
Screenshots 📷
Login Screen | Home Screen | Profile Screen |