Skip to content

MasterHiei/flutter_clean_architecture_example

Repository files navigation

Flutter Clean Architecture Example

A production-ready Flutter template implementing strict Clean Architecture with Domain-Driven Design (DDD).

Designed for scalability, testability, and maintainability using the Riverpod + Freezed + fpdart stack.

🚀 Quick Start

# 1. Install dependencies
flutter pub get

# 2. Generate code
dart run build_runner build --delete-conflicting-outputs

# 3. Run (Dev environment)
flutter run --flavor dev -t lib/main_dev.dart

🛠 Technology Stack

Core Library Purpose
State Riverpod Reactive state & DI (No setState)
Data Freezed Immutable Data Classes & Unions
Logic fpdart Functional Error Handling (Either<L, R>)
Network Dio + Retrofit Type-safe REST Client
Local Drift SQLite Database

📐 Architecture & Structure

This project follows a strict 4-layer architecture enforcing the Dependency Rule (Inner layers allow no external dependencies).

lib/
├── core/                   # Shared kernel (Failures, ValueObjects, Services)
├── features/               # Feature modules (DDD: Presentation, Application, Domain, Infra)
│   ├── auth/               # Example: Authentication feature
│   └── ...
├── shared/                 # Shared UI Design System
└── router/                 # AutoRoute configuration

📚 Documentation

Detailed documentation is maintained in .agent/:

🧪 Testing

We use Requirements-Driven Testing (mocking via mocktail).

flutter test

About

A Flutter app demonstrating the implementation of Clean Architecture and Domain-Driven Design (DDD) principles for scalable and maintainable code structure.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages