A production-ready, highly scalable Flutter template designed for modern application development. This project implements strictly typed Clean Architecture with Riverpod for state management and dependency injection.
- Strict Clean Architecture: Clear separation of Domain, Data, and Presentation layers.
- Functional Error Handling: Uses
fpdartfor type-safe error handling (Either<Failure, T>). - Riverpod 2.0: Modern provider patterns with
NotifierandAsyncNotifier. - Framework Independence: Domain and Data layers are testable without Flutter dependencies.
- Feature Generator: Create complete features in seconds (
./generate_feature.sh). - Strict Linting: Zero-tolerance analysis options for code quality.
- CI/CD Ready: GitHub Actions workflows for automated testing and analysis.
- Type Safety: Full null-safety and strict typing throughout.
- Real-Time Features: WebSocket integration example (Chat).
- Complex Forms: Advanced form handling with validation (Survey).
- Offline First: Local storage strategies with Hive/SharedPreferences.
- Secure Storage: Encrypted credential storage.
- Biometric Auth: FaceID and Fingerprint integration.
- Localization: Built-in multi-language support.
- Architecture Guide: Deep dive into the project structure.
- Coding Standards: Rules and patterns used in this project.
- Feature Guide: Documentation for core features.
- CLI Tools: How to use the generator scripts.
- Flutter SDK (3.7+)
- Dart SDK (3.0+)
# Clone the repository
git clone https://github.com/ssoad/flutter_riverpod_clean_architecture.git
# Install dependencies
flutter pub get
# Generate code (Freezed, Riverpod, etc.)
dart run build_runner build --delete-conflicting-outputs# Development
flutter run
# Production Build
flutter build apk --releaseDon't write boilerplate manually! Use the included generator script:
# Generate a full feature with UI, Domain, and Data layers
./generate_feature.sh --name my_awesome_featureThis creates:
domain/entities/,repositories/,usecases/data/models/,datasources/,repositories/presentation/providers/,screens/,widgets/providers/(DI configuration)- Unit tests for all layers
Start your project with the right identity! Use our renaming utility:
./rename_app.sh --app-name "My Super App" --package-name com.company.superappThis updates:
- Android:
AndroidManifest.xml,build.gradle, Kotlin files - iOS:
Info.plist, Project files - macOS, Windows, Linux Build files
- Dart package name & imports
Generate native app icons for all platforms in one command:
- Place your icon file (1024x1024) at
assets/icon/app_icon.png. - Run the generator script:
./generate_icons.shThis updates:
- Android
mipmapresources - iOS
Assets.xcassets - Web
manifest.jsonand icons - Windows/macOS/Linux icon files
lib/
βββ core/ # Shared kernel (Errors, Network, Utils)
βββ features/ # Feature modules
β βββ auth/ # Authentication Feature
β βββ chat/ # WebSocket Chat Feature
β βββ survey/ # Complex Form Feature
β βββ ...
βββ main.dart # Entry point
βββ ...
Each feature is a self-contained module:
feature_name/
βββ domain/ # 1. Innermost Layer (Pure Dart)
β βββ entities/ # Business objects (Equatable)
β βββ repositories/ # Abstract interfaces
β βββ usecases/ # Business logic units
βββ data/ # 2. Outer Layer (Implementation)
β βββ datasources/ # API/DB clients
β βββ models/ # JSON parsing & Adapters
β βββ repositories/ # Repository implementations
βββ presentation/ # 3. UI Layer (Flutter)
β βββ providers/ # UI State Management (Notifiers)
β βββ screens/ # Widget pages
β βββ widgets/ # Reusable components
βββ providers/ # 4. DI Layer (Riverpod)
βββ feature_providers.dart # Data layer dependency injection
We use a comprehensive testing strategy:
- Unit Tests: For Use Cases, Repositories, and Data Sources.
- Widget Tests: For reusable UI components.
- Golden Tests: For visual regression testing of screens.
# Run all tests
flutter test
# Update Golden files
flutter test --update-goldens- Fork the Project
- Create your Feature Branch (
git checkout -b feature/AmazingFeature) - Commit your Changes (
git commit -m 'Add some AmazingFeature') - Push to the Branch (
git push origin feature/AmazingFeature) - Open a Pull Request
Distributed under the MIT License. See LICENSE for more information.