A production-ready Flutter template built with the latest packages and best practices, supporting Flutter 3.32 and above. This template implements clean architecture principles and provides a robust foundation for building scalable applications.
- ποΈ Clean Architecture with Domain-Driven Design
- π― Riverpod 2.6+ with code generation
- π Built-in authentication pack with secure storage (Hive CE + AES-256)
- π Type-safe API integration with Dio 5.8+
- π± Responsive UI with adaptive widgets
- π Internationalization ready with Easy Localization
- πΎ Secure local storage with Hive CE
- π§ͺ Pre-configured unit testing for authentication and controller logic
- β‘ Modern navigation with GoRouter 14.8+
- π οΈ Custom linting and devtools configuration
Core Libraries:
- State Management: Riverpod 2.6.1, Freezed 3.0.6 (immutable state)
- Network Layer: Dio 5.8.0, FPDart 1.1.0 for functional error handling
- Local Storage: Hive CE 2.11.1 with AES-256 encryption
- UI & Navigation: GoRouter 14.8.0, Google Fonts 6.2.1, Material 3
Developer Tools:
- Flutter Lints 5.0.0
- Build Runner, code generation
- Custom linting rules (
lint_rules.yaml) - Dart & Flutter DevTools support
lib/
βββ common/ # Shared widgets and components
βββ config/ # App configuration (theme etc.)
βββ constants/ # App-wide constants (endpoints, assets)
βββ core/ # Core functionality, network layer
βββ features/ # Feature modules (authentication, home, ...)
β βββ authentication/
β βββ data/
β βββ domain/
β βββ presentation/
βββ hive/ # Local storage setup and adapters
βββ router/ # Navigation & routing
βββ utils/ # Utility functions
βββ main.dart # App entry point
βββ my_app.dart # App configuration
-
Clone the template:
git clone https://github.com/Erengun/Flutter-Riverpod-2.0-Template.git my_app cd my_app -
Install dependencies:
flutter pub get
-
Generate code:
dart run build_runner build --delete-conflicting-outputs
-
Setup environment:
cp .env.example .env
-
Run the app:
flutter run
The template includes a complete authentication system with secure credential storage and error handling.
- Login & Registration: Uses Dio to POST to
/api/loginand/api/registerendpoints. - Credential Caching: Credentials are securely cached in Hive CE using AES-256 encryption, with key derived per-device.
- State Management: All authentication UI and logic is managed via Riverpod notifiers and state classes.
- Error Handling: All network and validation errors are surfaced in the UI.
- Loading State: UI reflects loading and error states for a smooth UX.
You can test the authentication functionality using these credentials from reqres.in:
Login:
{
"email": "eve.holt@reqres.in",
"password": "cityslicka"
}Register:
{
"email": "eve.holt@reqres.in",
"password": "pistol"
}Example:
@riverpod
class LoginController extends _$LoginController {
// ... state and logic here
Future<LoginResponse> login({required String email, required String password}) async {
// Handles login, error handling, caching, loading state etc.
}
}- Integrated tests for auth controller logic (
test/features/login_controller_test.dart) - Run tests with:
flutter test
- Up-to-date documentation in this README
- Code comments and examples throughout
See our Contributing Guide for details on how to:
- Set up your development environment
- Run tests
- Submit pull requests
This project is licensed under the MIT License - see the LICENSE file for details.