A production-ready Flutter project template implementing Clean Architecture, BLoC state management, and Test-Driven Development (TDD). Designed as a reusable and scalable codebase for building high-quality Flutter applications in team environments.
- Clean Architecture (Domain, Data, Presentation layers)
- BLoC for predictable, testable state management
- TDD-first project flow with unit & widget test support
- Built-in folder & module structure for scaling large apps
- Reusable core utilities and base classes
- Easy to extend for new features and modules
- Pre-configured for multi-platform Flutter development
lib/
├── core/ # Common utilities, errors, constants, services
├── data/ # Data sources, repositories, models
├── domain/ # Entities & Use Cases (business rules)
├── presentation/ # UI, pages, widgets, blocs
└── main.dart # App entry
test/ # Unit & widget tests (TDD structured)
Each layer is strictly separated to maintain readability, scalability, and maintainability as the project grows.
git clone https://github.com/nuhan021/bloc_tdd_clean_arc.git
cd bloc_tdd_clean_arc
flutter pub get
flutter runRun tests:
flutter test- Entities
- Use Cases
- Repository Interfaces
Pure business logic. No Flutter imports.
- Repository Implementations
- API/Local data sources
- Models
Handles actual data operations and communicates with Domain via interfaces.
- UI (Screens & Widgets)
- BLoC (Events · States · Logic)
Separated UI logic ensures maintainability and testability.
This project follows a TDD flow:
- Write failing test
- Implement logic
- Pass the test
- Refactor where needed
Includes:
- Unit tests for domain/use cases
- Mock-driven tests for repositories
- Widget tests for UI states
- Start from Domain → create use case + entity
- Implement repository interface
- Add Data source & model
- Build BLoC for UI logic
- Create widgets/screens under Presentation
- Write tests for each layer
- Integrate into UI
This ensures consistency across the entire project.
Use this template when:
- Building medium to large-scale Flutter apps
- Working in a team environment
- You want long-term maintainability
- You prefer clean, modular, testable architecture
- You need to onboard new devs faster with a ready structure
If your team wants to extend or standardize additional modules (auth, networking, DI, caching), add them inside core/ or as separate feature modules following the same structure.
MIT License
Copyright (c) 2025 Nuhan
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including, without limitatio,n the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.