A scalable, maintainable Flutter project template using BLoC, Clean Architecture, GoRouter, Theming, Localization, and best practices.
- Splash Screen: Animated splash with timed navigation.
- Home Page: Central hub with navigation, dialog, and snackbar demos.
- Avatar Explorer:
- Fetch and display avatars from an API.
- Infinite scroll and pagination.
- Search and filter by name, gender, and age.
- Mark and view favorite avatars.
- Avatar details view.
- Profile Page: Placeholder for user profile features.
- Settings Page:
- Change app language at runtime.
- Multi-language support (English, Hindi, Gujarati, German).
- Theming: Light/dark mode toggle and theme demo.
- Localization: JSON-based, runtime language switching.
- Navigation: GoRouter-based, with tab navigation (Home, Profile, Settings).
- State Management: BLoC pattern, Hydrated BLoC for persistence.
- Dependency Injection: get_it for all repositories, blocs, and services.
- Utilities & Architecture:
- Feature-first folder structure.
- Code generation scripts for new features.
- Centralized constants, themes, and utility functions.
- Error handling and loading indicators.
- Advanced Notification Service:
- Local notification handling with payload parsing, extensible notification types, and robust error handling.
- Common Shimmer Widgets:
Shimmer,ShimmerLoading,CircleShimmer, andRoundedRectangleShimmerfor consistent loading placeholders across the app.
- Popup Dialog Utilities:
CommonDialog,PopupButton, andPopupTypefor platform-adaptive dialogs and reusable popup actions.
- Responsive Utilities:
ResponsiveUtilsand responsive extensions for adaptive UI scaling on mobile, tablet, and ultra-tablet devices.
- Common Scaffold & Image Widgets:
CommonScaffoldfor unified app layout with shimmer and keyboard handling.CommonAppImagefor standardized image display (network, asset, file, SVG).
- Barrel File Structure:
- All core modules and features use barrel files for clean, maintainable imports and exports.
- Feature-level barrels for widgets, bloc, data, entities, and repositories.
- Improved Documentation:
- All utilities, widgets, and constants are now fully documented with Dart doc comments and inline explanations.
- Consistent Constants:
Dimensclass for all UI spacing and sizing constants, ensuring design consistency.
- Code Quality:
- Unused/duplicate files removed, imports refactored, and code style enforced throughout the project.
- Flutter (latest stable)
- Dart
- flutter_dotenv for environment variables
flutter pub get
cp .env.example .env # Edit .env as neededflutter runlib/
core/ # Shared utilities, constants, theme, localization
features/ # Feature-first structure (see below)
di/ # Dependency injection setup (get_it)
router/ # App routing (GoRouter)
main.dart # Entry point
lib/features/sample_feature/
data/
datasources/
repositories/
domain/
entities/
repositories/
usecases/
presentation/
bloc/
view/
widgets/
- Managed with
flutter_dotenv. - Place your keys in
.env(see.env.example).
- Uses Flutter and BLoC recommended lints.
- Custom rules in
analysis_options.yamlenforce structure and code quality. - Run:
flutter analyze flutter format .
- Windows: Use
generate_feature.ps1(PowerShell).\generate_feature.ps1 - Mac/Linux/Any: Use
generate_feature.sh:chmod +x generate_feature.sh ./generate_feature.sh
- Prompts for feature name, creates all folders/files, and gives DI registration snippet.
- Uses get_it.
- Register your BLoC and repository in
di/service_locator.dart:getIt.registerFactory<SampleFeatureBloc>(() => SampleFeatureBloc()); getIt.registerLazySingleton<SampleFeatureRepository>(() => SampleFeatureRepositoryImpl());
- Inject into UI with
getIt<SampleFeatureBloc>().
- Centralized in
core/theme/. - Use
Theme.of(context)and custom color schemes. - Add new colors/fonts in
app_colors.dart,app_fonts.dart.
- Uses
core/config/app_strings.dartandassets/translations/. - Add new languages by adding JSON files and updating supported locales.
- Uses GoRouter in
router/app_router.dart. - Define routes and navigation logic centrally.
- Example:
context.goNamed(AppRouter.sampleFeatureScreen);
- API logic in
core/network/and feature data sources. - Interceptors (e.g., auth, logging) in
core/network/dio_interceptor.dart. - Example usage:
final response = await apiProvider.get(apiUrl: NetworkConstants.api);
- See
features/sample_feature/for a reference implementation:- BLoC, repository, DI, screen, theming, localization, and routing.
- Follow the structure and code style.
- Use the feature generator for new features.
- Register new BLoCs and repositories in DI.
- Add tests and documentation as you go.
Happy coding! 🎉