A production-ready Flutter starter template designed to provide a comprehensive foundation for building scalable and maintainable cross-platform applications. This project incorporates modern Flutter development practices, clean architecture, and a complete set of infrastructure components.
- Clean Architecture: Complete separation with data, domain, and presentation layers
- Feature-First Organization: Modular structure for unlimited scalability
- BLoC State Management: Predictable state management with
flutter_bloc
- Dependency Injection: Clean GetIt + injectable pattern
- Result Pattern: Type-safe error handling with Freezed
- Repository Pattern: Abstracted data access layer
- HTTP Client: Configured Dio client with interceptors
- Error Handling: Centralized network exception handling
- Authentication: JWT token management with auto-refresh
- Connectivity Monitoring: Real-time network status tracking
- Request/Response Logging: Comprehensive network debugging
- Local Storage: Hive-based key-value storage
- Secure Storage: Encrypted storage for sensitive data
- Caching: Multi-layered caching strategy
- Data Persistence: Automatic data synchronization
- Material Design 3: Latest design system implementation
- Dynamic Theming: Light/dark/system theme support
- Custom Components: Pre-built, reusable UI widgets
- Responsive Design: Adaptive layouts for all screen sizes
- Google Fonts: Typography system with Lato font family
- Multi-language Support: ARB-based localization
- RTL Support: Right-to-left language compatibility
- Dynamic Language Switching: Runtime language changes
- Input Validation: Comprehensive form validation framework
- Secure Storage: Biometric authentication support
- Environment Configuration: Secure environment variable management
- Analytics Framework: Pluggable analytics service architecture
- Error Tracking: Centralized error reporting
- Performance Monitoring: App performance metrics
- User Journey Tracking: Detailed user interaction analytics
- Unit Tests: Comprehensive test coverage
- Widget Tests: UI component testing
- BLoC Testing: State management testing
- Code Generation: Freezed for immutable data classes
- Linting: Strict code quality enforcement
- Flutter SDK: Version
^3.8.1
(Installation Guide) - Dart SDK: Bundled with Flutter
- IDE: Android Studio, VS Code, or IntelliJ IDEA
- Platform Tools: Xcode (iOS), Android Studio (Android)
-
Clone the repository:
git clone <repository-url> cd starter_forge
-
Install dependencies:
flutter pub get
-
Generate code:
flutter pub run build_runner build --delete-conflicting-outputs
-
Run the app:
flutter run
Create environment-specific configurations:
# Development
flutter run --dart-define=ENVIRONMENT=dev --dart-define=BASE_URL=https://api-dev.example.com
# Staging
flutter run --dart-define=ENVIRONMENT=staging --dart-define=BASE_URL=https://api-staging.example.com
# Production
flutter run --dart-define=ENVIRONMENT=prod --dart-define=BASE_URL=https://api.example.com
lib/
βββ app/ # App-level configuration
β βββ router/ # Navigation setup
β βββ injection.dart # Dependency injection configuration
βββ core/ # Shared core functionalities
β βββ analytics/ # Analytics service
β βββ config/ # Environment configuration
β βββ error/ # Error handling patterns
β βββ logging/ # Logging service
β βββ network/ # HTTP client & connectivity
β βββ storage/ # Local & secure storage
β βββ theme/ # App theming system
β βββ utils/ # Utilities & constants
β βββ validation/ # Form validation
β βββ widgets/ # Reusable UI components
βββ features/ # Business features
β βββ dashboard/ # Main dashboard feature
β β βββ data/ # Data sources & repositories
β β βββ domain/ # Business logic & entities
β β βββ presentation/ # UI, BLoCs, and screens
β βββ profile/ # User profile management
β βββ user_details/ # User details management
βββ generated/ # Generated code (l10n, etc.)
βββ l10n/ # Localization files
# Run all tests
flutter test
# Run tests with coverage
flutter test --coverage
# Generate HTML coverage report
genhtml coverage/lcov.info -o coverage/html
open coverage/html/index.html
flutter_bloc
- State managementget_it
- Dependency injection with injectable code generationgo_router
- Declarative routingdio
- HTTP clienthive
- Local storageflutter_secure_storage
- Secure storage
google_fonts
- Typographyconnectivity_plus
- Network monitoring- Material Design 3 - Design system
freezed
- Code generation for data classesjson_serializable
- JSON serializationbuild_runner
- Code generationflutter_lints
- Code quality
bloc_test
- BLoC testingmocktail
- Mocking framework
final client = sl<DioClient>();
final response = await client.get('/api/users');
// Simple key-value storage
await LocalStorage.setAppData('key', 'value');
final value = LocalStorage.getAppData<String>('key');
// Secure storage for sensitive data
await sl<SecureStorage>().setAccessToken(token);
// Track events
sl<AnalyticsManager>().trackEvent('button_clicked', parameters: {
'button_name': 'sign_up',
'screen': 'home',
});
// Track screen views
sl<AnalyticsManager>().trackScreenView('home');
// Monitor connectivity
sl<ConnectivityService>().connectionStream.listen((isConnected) {
if (isConnected) {
// Handle online state
} else {
// Handle offline state
}
});
// Enhanced button with loading states
AppButton(
text: 'Submit',
variant: AppButtonVariant.primary,
isLoading: isSubmitting,
onPressed: () => _handleSubmit(),
)
// Enhanced text field with validation
AppTextField(
label: 'Email',
validator: Validators.email,
onChanged: (value) => _handleEmailChanged(value),
)
- Linting: Enforced via
analysis_options.yaml
- Formatting: Use
dart format .
- Analysis: Run
flutter analyze
- Architecture: Clean Architecture principles
- Testing: Comprehensive test coverage
# Android
flutter build apk --release
flutter build appbundle --release
# iOS
flutter build ios --release
# Web
flutter build web --release
# Desktop
flutter build macos --release
flutter build windows --release
flutter build linux --release
Set these in your CI/CD pipeline:
ENVIRONMENT
- dev/staging/prodBASE_URL
- API base URLENABLE_ANALYTICS
- Analytics toggleENABLE_LOGGING
- Logging toggle
- Fork the repository
- Create a feature branch:
git checkout -b feature/amazing-feature
- Commit changes:
git commit -m 'Add amazing feature'
- Push to branch:
git push origin feature/amazing-feature
- Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
- Flutter team for the amazing framework
- Material Design team for the design system
- Open source community for the excellent packages
Built with β€οΈ for the Flutter community
This starter template provides everything you need to build production-ready Flutter applications with clean architecture, comprehensive testing, and modern development practices.
For detailed refactoring guides and architectural decisions, see docs/refactoring/.