flutter_blueprint 1.7.1
flutter_blueprint: ^1.7.1 copied to clipboard
Production-ready Flutter CLI scaffolding tool with multi-platform support, advanced state management (Provider/Riverpod/Bloc), security, authentication, offline-first architecture, localization, and M [...]
๐ฏ flutter_blueprint #
Enterprise-grade Flutter app scaffolding CLI โ generates production-ready Flutter projects with 43+ professional files, complete architecture, authentication patterns, error handling, storage layers, and reusable widgets. Stop wasting hours on boilerplate โ start building features from day one.
๐ฑ Important Note: This is a CLI tool that runs on your development machine (Windows, Linux, macOS) to generate Flutter projects. The generated projects support ALL platforms: Android, iOS, Web, and Desktop. The CLI itself uses terminal-based UI libraries and thus only runs on desktop platforms, but the apps it creates work everywhere!
โจ Flutter 3.38 Ready: Fully compatible with Flutter 3.38 and Dart 3.10, including Material 3 design, latest package versions, and enhanced performance monitoring for Impeller rendering.
๐ Why flutter_blueprint? #
| Problem | Traditional Approach | flutter_blueprint Solution |
|---|---|---|
flutter create gives bare bones |
Hours of manual setup | 43+ files with pro patterns instantly |
| GitHub templates are opinionated & bloated | Copy-paste, delete unused code | Modular generation - only what you need |
| No professional error handling | Build it yourself | Custom exceptions + Failures out of the box |
| Basic HTTP setup missing interceptors | Add Dio, configure manually | Auth, Retry, Logger interceptors included |
| No reusable widgets | Create from scratch | Loading, Error, Empty states ready to use |
| Form validation boilerplate | Write validators each time | Email, password, phone validators built-in |
| Storage layer missing | Mix SharedPrefs everywhere | LocalStorage + SecureStorage wrappers |
| No proper logging | print() statements everywhere | Professional Logger with levels |
flutter_blueprint is not just a template โ it's a smart code generator that creates production-grade architecture tailored to your choices.
โจ Features #
Core Features #
| Feature | Description | Generated Files |
|---|---|---|
| โก One-command setup | flutter_blueprint init my_app |
42-46 files in seconds |
| ๐งฑ Clean architecture | Separation of concerns (core/, features/, app/) | Professional folder structure |
| ๐ฏ State management | Provider, Riverpod, OR Bloc | Choose your preferred pattern |
| ๐จ Theming system | Material 3 (useMaterial3: true) with custom colors & typography | AppTheme, AppColors, Typography |
| ๐ Internationalization | ARB files + intl config ready | en.arb, hi.arb, localization |
| ๐ ๏ธ Environment config | Dev/Stage/Prod with .env support | EnvLoader + .env.example |
| ๐งญ Professional routing | Route names, guards, centralized navigation | AppRouter, RouteGuard, Routes |
| ๐ฑ Multi-platform support | Mobile, Web, Desktop - all in one project | Universal or single-platform |
| ๐ Pagination support | Infinite scroll + pull-to-refresh + skeletons | PaginationController + UI |
| ๐ Analytics & Crash Reporting | Firebase Analytics/Crashlytics OR Sentry | Unified API + Error tracking |
| ๐ Security Best Practices | 4 security levels (basic โ enterprise) | 9 security utilities + patterns |
| ๐ง Memory Management | 3 levels (none โ advanced) with leak detection | 7 memory utilities + profiling |
| ๐ท Advanced Riverpod Patterns | 3 levels (none โ advanced) with code generation | 6 pattern generators + examples |
| ๐ Advanced Localization | 3 levels (none โ advanced) with ARB + RTL | 5 localization utilities + 12+ languages |
| ๐ Advanced Authentication | 3 levels (none โ advanced) with JWT + OAuth | 6 auth utilities (JWT, OAuth, biometric) |
| ๐ด Offline-First Architecture | 3 levels (none โ advanced) with sync + conflicts | 7 offline utilities (sync queue, resolver, background sync, repository, network monitor, coordinator, examples) |
Professional Add-ons (What Makes It Pro) #
| Feature | What You Get |
|---|---|
| ๏ฟฝ Production API Client | Dio + Auth/Retry/Logger interceptors + Generic methods (GET/POST/PUT/DELETE) |
| ๐จ Error Handling System | 9 custom exception classes + Failures for clean architecture |
| ๐ Professional Logger | AppLogger with debug/info/warning/error/success levels |
| โ Form Validators | Email, password, phone, required, minLength, maxLength, numeric |
| ๐พ Storage Layers | LocalStorage (SharedPreferences wrapper) + SecureStorage (tokens) |
| ๏ฟฝ Reusable Widgets | LoadingIndicator, ErrorView, EmptyState, CustomButton, CustomTextField |
| ๐ Network Monitoring | NetworkInfo with connectivity checks |
| ๏ฟฝ Extensions & Utils | String, DateTime, Context extensions + Constants |
| ๐งช Professional Tests | Validator tests, test helpers, widget tests |
| ๐ Smart File Organization | Constants (endpoints, app), Errors, Network, Utils, Widgets |
| ๐ Auto-Update Checker | Automatically notifies you when a new version is available |
| ๐ Security Utilities | Certificate pinning, biometric auth, encrypted storage, root detection |
| ๐ง Memory Management | Disposable patterns, memory profiling, leak detection, image cache manager |
DevOps Integration (NEW in v0.5.0!) #
| Feature | What You Get |
|---|---|
| ๐ CI/CD Scaffold Generation | GitHub Actions, GitLab CI, or Azure Pipelines - ready on first commit |
| โ Automated Quality Gates | Flutter analyze, dart format check, and automated tests |
| ๐ Coverage Reporting | Code coverage tracking with Codecov/built-in reports |
| ๐๏ธ Multi-Platform Builds | Automated Android APK + iOS IPA generation |
| ๐ฅ Deployment Templates | Firebase App Distribution integration ready to use |
๐ฆ Installation #
Windows (Automated Installer) #
For the best experience on Windows, use the automated installer. It handles adding the tool to your system's PATH automatically.
Open PowerShell and run the following command:
iex (irm 'https://raw.githubusercontent.com/chirag640/flutter_blueprint-Package/main/scripts/install.ps1')
After the script finishes, restart your terminal, and you can use the CLI anywhere.
macOS / Linux / Other #
For other platforms, or for manual installation, you can use dart pub global activate.
dart pub global activate flutter_blueprint
Note: If you use this method, you may need to manually add the pub cache
bindirectory to your system's PATH. The command will provide the correct directory if needed.
Then use it anywhere:
flutter_blueprint init my_app
Local Execution #
dart run flutter_blueprint init my_app
๐ฌ Quick Start #
โจ Interactive Wizard Mode (Recommended) #
Just run without arguments for a beautiful guided experience:
flutter_blueprint init
What happens:
๐ฏ Welcome to flutter_blueprint!
Let's create your Flutter app with professional architecture.
โ ๐ฑ App name ยท my_awesome_app
โ ๐ฏ Choose state management ยท provider
โข Provider (ChangeNotifier, easy to learn)
โข Riverpod (Compile-time safe, better testability) โ NEW!
โข Bloc (Event-driven, coming soon)
[Use โโ arrow keys, Enter to select]
โ โจ Select features to include (use space to select, enter to confirm)
โ Theme system (Light/Dark modes)
โ Localization (i18n support)
โ Environment config (.env)
โ API client (Dio + interceptors)
โ Test scaffolding
โ Hive offline caching (storage + sync)
โ Pagination support (infinite scroll + skeleton loaders)
๐ Configuration Summary:
App name: my_awesome_app
State management: provider
Theme: โ
Localization: โ
Environment: โ
API client: โ
Tests: โ
Hive caching: โ
Pagination: โ
โ ๐ Ready to generate your app? ยท yes
๐ Generating project structure...
โ
Generated 43 files successfully!
Features:
- ๐จ Beautiful UI with emojis and colors
- โจ๏ธ Arrow key navigation for selections
- โ๏ธ Multi-select checkboxes for features (spacebar to toggle)
- โ Smart validation (prevents reserved words, invalid names)
- ๐ Configuration preview before generation
โก Quick Mode (For Experienced Users) #
Skip the wizard by providing the app name:
flutter_blueprint init my_app
Add flags for full control:
# Provider template (classic ChangeNotifier pattern)
flutter_blueprint init my_app \
--state provider \
--theme \
--env \
--api \
--tests
# Riverpod template (compile-time safe with StateNotifier)
flutter_blueprint init my_app \
--state riverpod \
--theme \
--env \
--api \
--tests \
--no-localization
# With Hive offline caching (NEW in v0.9.4!)
flutter_blueprint init my_app --state bloc --api --hive
# With pagination support (NEW in v0.9.5!)
flutter_blueprint init my_app --state riverpod --api --pagination
# Combine Hive + Pagination for production-ready apps
flutter_blueprint init my_app --state bloc --api --hive --pagination
# With Analytics & Crash Reporting
flutter_blueprint init my_app --analytics firebase --state bloc
flutter_blueprint init my_app --analytics sentry --state riverpod
# With Security Best Practices (NEW in v1.2.0!)
flutter_blueprint init my_app --security basic --state bloc
flutter_blueprint init my_app --security standard --state riverpod
flutter_blueprint init my_app --security enterprise --state bloc
# Full-featured production app
flutter_blueprint init my_app --state bloc --api --hive --pagination --analytics firebase --security enterprise --ci github
# With CI/CD configuration
flutter_blueprint init my_app --ci github
flutter_blueprint init my_app --state riverpod --ci gitlab
flutter_blueprint init my_app --state bloc --ci azure
# Multi-platform support (NEW!)
flutter_blueprint init my_app --platforms mobile,web
flutter_blueprint init my_app --platforms all --state bloc
flutter_blueprint init my_desktop_app --platforms desktop --state riverpod
Hybrid Mode (Mix Both) #
flutter_blueprint init my_app --state riverpod
# Prompts for remaining options
๏ฟฝ Multi-Platform Support (NEW in v0.4.0!) #
Build apps that run on mobile, web, AND desktop from a single codebase! flutter_blueprint now generates universal multi-platform projects with responsive layouts, adaptive navigation, and platform-specific optimizations.
Quick Start #
# Mobile + Web
flutter_blueprint init my_app --platforms mobile,web --state bloc
# All platforms (universal app)
flutter_blueprint init my_app --platforms all --state riverpod
# Desktop only
flutter_blueprint init my_desktop_app --platforms desktop --state provider
Platform Options #
| Option | Description | Generated Files |
|---|---|---|
--platforms mobile |
iOS & Android only (default) | Standard mobile project |
--platforms web |
Web application only | web/index.html, PWA manifest, URL strategy |
--platforms desktop |
Windows, macOS, Linux | Window management, desktop optimizations |
--platforms mobile,web |
Multi-platform project (mobile + web) | Responsive layouts, adaptive UI |
--platforms all |
Universal app (mobile + web + desktop) | Complete multi-platform solution |
Interactive Multi-Select #
In wizard mode, select multiple platforms with checkboxes:
๐ป Choose target platforms (space to select, enter to confirm):
[x] Mobile (iOS & Android)
[x] Web
[x] Desktop (Windows, macOS, Linux)
What Gets Generated for Multi-Platform #
Universal Entry Points:
lib/
โโโ main.dart # Universal router (detects platform)
โโโ main_mobile.dart # Mobile-specific initialization
โโโ main_web.dart # Web-specific initialization (URL strategy)
โโโ main_desktop.dart # Desktop-specific initialization (window manager)
Responsive & Adaptive Components:
lib/core/responsive/
โโโ breakpoints.dart # Mobile/Tablet/Desktop breakpoints
โโโ responsive_layout.dart # Responsive widget (adapts to screen size)
โโโ adaptive_scaffold.dart # Adaptive navigation (bottom nav โ rail โ drawer)
โโโ responsive_spacing.dart # Responsive padding & spacing helpers
lib/core/utils/
โโโ platform_info.dart # Platform detection utilities
Platform-Specific Files:
- Web:
web/index.html,web/manifest.json(PWA-ready) - Desktop: Window configuration, title bar customization
Smart Dependency Management #
Dependencies are automatically added based on selected platforms:
# Common (all platforms)
dependencies:
# Responsive & sizing (recommended)
flutter_screenutil: ^5.7.1
# Web-specific
url_strategy: ^0.3.0
# Desktop-specific
window_manager: ^0.4.3
path_provider: ^2.1.5
Responsive Features #
Breakpoints:
// The generated responsive utilities use flutter_screenutil and LayoutBuilder.
// Example breakpoint helpers are provided in `core/config/responsive_config.dart`.
if (Breakpoints.isMobile(context)) {
// Show mobile layout
} else if (Breakpoints.isTablet(context)) {
// Show tablet layout
} else {
// Show desktop layout
}
Responsive Layouts:
ResponsiveLayout(
mobile: MobileView(), // < 768px
tablet: TabletView(), // 768px - 1280px
desktop: DesktopView(), // >= 1280px
)
Adaptive Navigation:
- Mobile: Bottom navigation bar
- Tablet: Navigation rail
- Desktop: Side drawer/rail
Platform Detection #
if (PlatformInfo.isWeb) {
// Web-specific code
} else if (PlatformInfo.isDesktop) {
// Desktop-specific code
} else if (PlatformInfo.isMobile) {
// Mobile-specific code
}
Running Multi-Platform Projects #
# Mobile
flutter run -d <device-id>
# Web
flutter run -d chrome
# Desktop
flutter run -d windows # or macos, linux
Building for Production #
# Mobile
flutter build apk # Android
flutter build ios # iOS
# Web
flutter build web
# Desktop
flutter build windows # Windows
flutter build macos # macOS
flutter build linux # Linux
When to Use Multi-Platform #
โ Use multi-platform when:
- Building web + mobile versions of the same app
- Need desktop companion app for your mobile app
- Want to maximize code reuse across platforms
- Building internal tools that need to run everywhere
โ Use single-platform when:
- Platform-specific features are critical (AR, NFC, etc.)
- Performance is absolutely critical
- Simple mobile-only app
- Heavy platform-specific UI requirements
๐ CI/CD Integration #
Generate production-ready CI/CD configurations with a single flag. Your project will be ready for automated testing and deployment from day one!
Quick Start #
# GitHub Actions
flutter_blueprint init my_app --ci github
# GitLab CI
flutter_blueprint init my_app --ci gitlab
# Azure Pipelines
flutter_blueprint init my_app --ci azure
What Gets Generated #
| Provider | File | Pipeline Stages |
|---|---|---|
| GitHub | .github/workflows/ci.yml |
Analyze โ Test โ Build Android โ Build iOS |
| GitLab | .gitlab-ci.yml |
analyze โ test โ build:android โ build:ios |
| Azure | azure-pipelines.yml |
Analyze Stage โ Test Stage โ Build Stage (Android + iOS) |
Pipeline Features #
All generated CI/CD configurations include:
- โ
Code Quality:
flutter analyze+dart formatchecks - ๐งช Automated Testing: Unit tests with coverage reporting
- ๐ฑ Android Build: APK generation with artifact upload
- ๐ iOS Build: IPA generation (with codesigning instructions)
- ๐ Coverage Reports: Codecov integration (GitHub) / built-in reports
- ๐ Auto-retry: Failed requests handled automatically
- ๐ฆ Artifact Storage: Build outputs saved for 7 days
Example: GitHub Actions Workflow #
name: CI/CD Pipeline
on:
push:
branches: [main, develop]
pull_request:
branches: [main, develop]
jobs:
analyze:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: subosito/flutter-action@v2
- run: flutter analyze
- run: dart format --set-exit-if-changed .
test:
needs: analyze
runs-on: ubuntu-latest
steps:
- run: flutter test --coverage
- uses: codecov/codecov-action@v4
build-android:
needs: test
runs-on: ubuntu-latest
steps:
- run: flutter build apk --release
- uses: actions/upload-artifact@v4
Deployment Ready #
Generated workflows include commented templates for:
- ๐ฅ Firebase App Distribution - Deploy to testers instantly
- ๐ TestFlight - iOS beta deployment
- โ๏ธ Code Signing - Instructions for production builds
Setup Instructions #
After generating your project with CI/CD:
For GitHub Actions:
- Push your code to GitHub
- Workflow runs automatically on push/PR
- (Optional) Add
CODECOV_TOKENsecret for coverage reports
For GitLab CI:
- Push your code to GitLab
- Pipeline runs automatically on push/MR
- For iOS builds: Configure macOS runner in
.gitlab-ci.yml
For Azure Pipelines:
- Push your code to Azure Repos
- Install Flutter extension for Azure Pipelines
- Pipeline runs automatically on push/PR
๐ค Collaboration & Team Features #
Shared Blueprint Configurations #
Share standards across your entire team! Flutter Blueprint includes a powerful configuration sharing system that lets you create, share, and enforce project standards organization-wide.
Why Use Shared Configurations? #
- Instant consistency - All team members use the same setup
- Faster onboarding - New developers start with proven templates
- Enforce standards - Architecture decisions baked into project creation
- Share best practices - Distribute knowledge through configuration
- Reduce setup time - From hours to seconds
Share Command #
Manage shared configurations with the share command:
# List all available shared configurations
flutter_blueprint share list
# Import a configuration from file
flutter_blueprint share import ./company_standard.yaml
# Import with custom name
flutter_blueprint share import ./config.yaml --name my_config
# Export a configuration
flutter_blueprint share export company_standard ./exported.yaml
# Delete a configuration
flutter_blueprint share delete old_config
# Validate a configuration file
flutter_blueprint share validate ./config.yaml
# Use a shared configuration to create project
flutter_blueprint init my_app --from-config company_standard
Configuration Structure #
Shared configurations can define:
name: company_standard
description: Company-wide Flutter project standards
version: 1.0.0
author: Engineering Team
# State management preference
state_management: bloc # bloc, provider, riverpod
# Supported platforms
platforms:
- android
- ios
- web
- windows
# CI/CD provider
cicd_provider: github # github, gitlab, azure
# Code style preferences
code_style:
line_length: 120
prefer_single_quotes: true
use_trailing_commas: true
# Architecture rules
architecture:
enforce_clean_architecture: true
feature_structure: domain_driven
use_dependency_injection: true
# Required packages
required_packages:
- dio
- get_it
- injectable
- flutter_bloc
- equatable
# Testing requirements
testing:
require_unit_tests: true
require_widget_tests: true
min_coverage: 80
# Custom metadata
metadata:
team: mobile_engineering
updated: 2025-11-01
Example Configurations Included #
Flutter Blueprint comes with 3 production-ready configurations:
1. Company Standard (company_standard)
Enterprise-grade setup with Bloc, full platform support, and comprehensive testing:
flutter_blueprint init my_app --from-config company_standard
Features:
- Bloc state management
- All platforms (Android, iOS, Web, Windows, macOS, Linux)
- GitHub Actions CI/CD
- 120 char line length
- Clean Architecture enforced
- Required packages: dio, get_it, injectable, flutter_bloc
2. Startup Template (startup_template)
Lightweight MVP configuration for rapid prototyping:
flutter_blueprint init my_mvp --from-config startup_template
Features:
- Provider state management (simpler learning curve)
- Mobile-first (Android, iOS, Web)
- GitHub Actions CI/CD
- Minimal package dependencies
- Fast iteration focus
3. Enterprise Template (enterprise_template)
Full-featured configuration for large-scale applications:
flutter_blueprint init my_enterprise_app --from-config enterprise_template
Features:
- Riverpod state management
- All platforms
- Azure Pipelines (enterprise CI/CD)
- Strict code style (80 char lines)
- Comprehensive testing requirements (80% coverage)
- Full dependency injection with get_it + injectable
Creating Custom Configurations #
- Export an existing configuration as a starting point:
flutter_blueprint share export company_standard ./my_template.yaml
- Edit the YAML file to match your needs:
name: my_custom_config
description: My team's Flutter standards
version: 1.0.0
state_management: riverpod
platforms:
- android
- ios
- web
code_style:
line_length: 100
prefer_single_quotes: true
required_packages:
- riverpod
- freezed
- dio
- Import your custom configuration:
flutter_blueprint share import ./my_template.yaml
- Use it to create projects:
flutter_blueprint init my_app --from-config my_custom_config
Team Workflow Example #
Setup (One-time):
# Engineering lead creates and shares configuration
flutter_blueprint share import ./company_standard.yaml
# Commit the configuration file to your team repo
git add shared_configs/company_standard.yaml
git commit -m "Add company Flutter standard"
git push
Daily Use (All developers):
# Pull latest configurations
git pull
# Import any new/updated configurations
flutter_blueprint share import ./shared_configs/company_standard.yaml
# Create new project using shared standard
flutter_blueprint init my_new_feature --from-config company_standard
# All team members get identical setup! โจ
Validation #
All configurations are validated before use:
# Validate before importing
flutter_blueprint share validate ./config.yaml
Checks:
- Required fields present (name, version, state_management)
- Valid state management choice
- Valid platform selections
- Valid CI/CD provider
- Proper YAML structure
- Package names are valid
Benefits for Teams #
| Without Shared Configs | With Shared Configs |
|---|---|
| 2-4 hours setup time | 5 minutes |
| Inconsistent structure | Identical structure |
| Manual standard enforcement | Automatic enforcement |
| Knowledge in docs/wikis | Executable standards |
| Onboarding: 1-2 days | Onboarding: 30 mins |
Documentation #
For complete documentation on collaboration features, see:
- COLLABORATION_FEATURES.md - Comprehensive collaboration guide
- PERFORMANCE_OPTIMIZATION.md - Performance monitoring and optimization
- ANALYTICS_IMPLEMENTATION.md - Analytics & crash reporting setup guide
๐ฏ State Management Templates #
flutter_blueprint supports multiple state management patterns โ choose the one that fits your team and project best!
๐ Comparison Table #
| Feature | Provider ๐ข | Riverpod ๐ฆ | Bloc ๐ฃ (Coming Soon) |
|---|---|---|---|
| Package | provider: ^6.1.2 |
flutter_riverpod: ^2.5.1 |
flutter_bloc: ^8.1.0 |
| Learning Curve | Easy - ChangeNotifier pattern | Medium - New concepts | Steep - Event-driven architecture |
| Compile-Time Safety | โ Runtime errors possible | โ Catch errors at compile time | โ Strong typing |
| Testability | Good - MockNotifier needed | Excellent - ProviderContainer | Excellent - Easy to mock |
| State Class | ChangeNotifier |
StateNotifier<State> |
Cubit<State> or Bloc<E, S> |
| UI Update | notifyListeners() |
state = state.copyWith(...) |
emit(newState) |
| Widget Pattern | Consumer<T> / Provider.of |
ConsumerWidget + ref.watch() |
BlocBuilder / BlocConsumer |
| Dependency Injection | MultiProvider wrapper |
ProviderScope + global providers |
BlocProvider tree |
| Automatic Disposal | Manual dispose() required |
โ Automatic | โ Automatic |
| Generated Files | 43 files | 42 files | TBD |
| Best For | Small-medium apps, rapid prototyping | Large apps, enterprise, strong teams | Complex state, event-driven logic |
๐ข Provider Template #
When to use: You want simplicity, familiarity, and quick onboarding for new Flutter developers.
Example State Management:
// home_provider.dart
class HomeProvider extends ChangeNotifier {
bool _isLoading = false;
int _counter = 0;
void incrementCounter() {
_counter++;
notifyListeners(); // Manual notification
}
}
// home_content.dart
Consumer<HomeProvider>(
builder: (context, provider, child) {
return Text('Counter: ${provider.counter}');
},
)
๐ฆ Riverpod Template (NEW!) #
When to use: You want compile-time safety, better testability, and you're building a large-scale app.
Example State Management:
// home_provider.dart
class HomeState {
final bool isLoading;
final int counter;
HomeState({required this.isLoading, required this.counter});
HomeState copyWith({bool? isLoading, int? counter}) {
return HomeState(
isLoading: isLoading ?? this.isLoading,
counter: counter ?? this.counter,
);
}
}
class HomeNotifier extends StateNotifier<HomeState> {
HomeNotifier() : super(HomeState(isLoading: false, counter: 0));
void incrementCounter() {
state = state.copyWith(counter: state.counter + 1); // Immutable update
}
}
final homeProvider = StateNotifierProvider<HomeNotifier, HomeState>((ref) {
return HomeNotifier();
});
// home_content.dart
class HomeContent extends ConsumerWidget {
@override
Widget build(BuildContext context, WidgetRef ref) {
final homeState = ref.watch(homeProvider); // Auto-rebuild on changes
return Column(
children: [
Text('Counter: ${homeState.counter}'),
ElevatedButton(
onPressed: () => ref.read(homeProvider.notifier).incrementCounter(),
child: Text('Increment'),
),
],
);
}
}
Riverpod Benefits:
- โ No BuildContext needed - access providers anywhere
- โ Compile-time errors - typos caught immediately
- โ Immutable state - easier debugging with state history
- โ Auto-disposal - no memory leaks
- โ
Better testing - use
ProviderContainerfor isolated tests - โ Family & AutoDispose modifiers for advanced use cases
๐ฃ Bloc Template (Coming Soon!) #
When to use: You need event-driven architecture, complex business logic, or team is familiar with BLoC pattern.
Stay tuned for Bloc support!
๐งฉ Generated Project Structure (43+ Files!) #
my_app/
โโโ lib/
โ โโโ main.dart # App entry point
โ โโโ app/
โ โ โโโ app.dart # Root app widget with providers
โ โโโ core/
โ โ โโโ api/ # ๐ Network layer
โ โ โ โโโ api_client.dart # Dio client with GET/POST/PUT/DELETE
โ โ โ โโโ api_response.dart # Generic response wrapper
โ โ โ โโโ interceptors/
โ โ โ โโโ auth_interceptor.dart # Auto-add auth tokens
โ โ โ โโโ retry_interceptor.dart # Auto-retry failed requests
โ โ โ โโโ logger_interceptor.dart # Log all API calls
โ โ โโโ config/
โ โ โ โโโ app_config.dart # ๐๏ธ App configuration
โ โ โ โโโ env_loader.dart # Dev/Stage/Prod environments
โ โ โโโ constants/
โ โ โ โโโ app_constants.dart # ๐ Timeouts, storage keys, pagination
โ โ โ โโโ api_endpoints.dart # Centralized API routes
โ โ โโโ errors/
โ โ โ โโโ exceptions.dart # ๐จ 9 custom exception types
โ โ โ โโโ failures.dart # Clean architecture failures
โ โ โโโ network/
โ โ โ โโโ network_info.dart # ๐ก Connectivity monitoring
โ โ โโโ routing/
โ โ โ โโโ app_router.dart # ๐งญ Route management
โ โ โ โโโ route_guard.dart # Auth guards
โ โ โ โโโ route_names.dart # Centralized route constants
โ โ โโโ storage/
โ โ โ โโโ local_storage.dart # ๐พ SharedPreferences wrapper
โ โ โ โโโ secure_storage.dart # Secure token storage
โ โ โโโ database/ # ๐๏ธ Optional: Hive offline caching
โ โ โ โโโ hive_database.dart # Singleton Hive DB manager
โ โ โ โโโ cache_manager.dart # TTL/LRU/Size eviction strategies
โ โ โ โโโ sync_manager.dart # Offline queue with retry logic
โ โ โโโ pagination/ # ๐ Optional: Pagination system
โ โ โ โโโ pagination_controller.dart # Generic pagination controller
โ โ โ โโโ paginated_list_view.dart # Infinite scroll widget
โ โ โ โโโ skeleton_loader.dart # Animated loading skeletons
โ โ โโโ theme/
โ โ โ โโโ app_theme.dart # ๐จ Light/Dark themes
โ โ โ โโโ app_colors.dart # Color palette
โ โ โ โโโ typography.dart # Text styles
โ โ โโโ utils/
โ โ โ โโโ logger.dart # ๐ Pro logger (debug/info/warn/error)
โ โ โ โโโ validators.dart # Form validators (email/phone/etc)
โ โ โ โโโ extensions.dart # String/DateTime/Context extensions
โ โ โโโ widgets/ # ๐งฉ Reusable UI components
โ โ โโโ loading_indicator.dart # Loading spinner
โ โ โโโ error_view.dart # Error display with retry
โ โ โโโ empty_state.dart # Empty list placeholder
โ โ โโโ custom_button.dart # Button with loading state
โ โ โโโ custom_text_field.dart # Styled text input
โ โโโ features/
โ โโโ home/ # ๐ Sample feature (clean architecture)
โ โโโ presentation/
โ โโโ pages/
โ โ โโโ home_page.dart # Home screen
โ โโโ providers/
โ โ โโโ home_provider.dart # State management
โ โโโ widgets/
โ โโโ home_content.dart # Home UI components
โโโ assets/
โ โโโ l10n/
โ โโโ en.arb # ๐ English translations
โ โโโ hi.arb # Hindi translations
โโโ test/
โ โโโ widget_test.dart # ๐งช Sample widget test
โ โโโ core/
โ โ โโโ utils/
โ โ โโโ validators_test.dart # Validator unit tests
โ โโโ helpers/
โ โโโ test_helpers.dart # Test utilities
โโโ .env.example # ๐ Environment variables template
โโโ blueprint.yaml # ๐ Project metadata
โโโ pubspec.yaml # ๐ฆ Dependencies
File Count by Feature Set:
- Minimal (no optional features): 19 files
- Standard (theme + API + tests): 43 files
- Full Stack (all features + Hive + Pagination): 49 files
- Enterprise (all features + Hive + Pagination + Analytics): 54 files ๐
๐ง Architecture Principles #
Clean Separation of Concerns #
core/: Shared infrastructure (config, theme, routing, API)features/: Business logic organized by featureapp/: Root app configuration and providers
Dependency Injection Ready #
Uses Provider for service location:
Provider<AppConfig>(create: (_) => AppConfig.load()),
Provider<ApiClient>(create: (context) => ApiClient(context.read<AppConfig>())),
Type-Safe Configuration #
class AppConfig {
final String appTitle;
final String environment;
final String apiBaseUrl;
// ...
}
๐ ๏ธ CLI Commands #
init - Create New Project #
flutter_blueprint init <app_name> [options]
Options:
| Flag | Description | Default |
|---|---|---|
--state <choice> |
State management (provider/riverpod/bloc) | Interactive prompt |
--platforms <list> |
Target platforms (mobile/web/desktop or comma-separated or "all") | mobile |
--ci <provider> |
CI/CD provider (github/gitlab/azure) | none |
--theme |
Include theme scaffolding | Interactive prompt |
--localization |
Include l10n setup | Interactive prompt |
--env |
Include environment config | Interactive prompt |
--api |
Include API client | Interactive prompt |
--tests |
Include test scaffolding | Interactive prompt |
--hive |
Include Hive offline caching (storage + cache + sync) | false |
--pagination |
Include pagination support (infinite scroll + skeletons) | false |
--analytics <provider> |
Include analytics & crash reporting (firebase/sentry/none) | none |
--security <level> |
Security best practices (none/basic/standard/enterprise) | none |
-h, --help |
Show help | - |
-v, --version |
Show version | - |
add feature - Incremental feature generation (killer feature) #
Add a new feature to an existing project without touching the rest of your app. The command scaffolds clean-architecture folders (data/domain/presentation), generates state-management boilerplate that matches the project's blueprint.yaml (Provider, Riverpod or BLoC), and injects a new route into app_router.dart.
Usage:
# Full feature with all layers
flutter_blueprint add feature <feature_name>
# Only presentation layer
flutter_blueprint add feature settings --presentation --no-data --no-domain
# Add feature with remote API integration
flutter_blueprint add feature products --api
Flags:
| Flag | Description |
|---|---|
--data / --no-data |
Generate data layer (models, data sources, repository) |
--domain / --no-domain |
Generate domain layer (entities, repository contract, use cases) |
--presentation / --no-presentation |
Generate presentation layer (pages, widgets, state) |
--api |
Include remote data source (Dio) in the data layer |
Behavior & notes:
- The command must be run from the root of a previously generated flutter_blueprint project (it reads
blueprint.yaml). - It detects the project's state-management setting from
blueprint.yamland emits matching files for Provider, Riverpod, or Bloc. - If
app_router.dartexists, the generator will add the page import, a route constant toRouteNames, and acasein the router switch to return the new page. - The generator is idempotent for route insertion: it will not duplicate imports or constants if they already exist.
- For Riverpod/Bloc the generated state files follow the project's Dart version (uses sealed classes / StateNotifier / Bloc patterns as appropriate).
Examples:
# Generate a full "auth" feature using the project's state-management
flutter_blueprint add feature auth
# Generate only presentation for "settings"
flutter_blueprint add feature settings --presentation --no-data --no-domain
# Generate products feature and include remote API data source
flutter_blueprint add feature products --api
๐ blueprint.yaml #
Every generated project includes a blueprint.yaml manifest:
version: 1
app_name: my_app
platforms:
- mobile
- web
state_management: provider
ci_provider: github
features:
api: true
env: true
localization: false
tests: true
theme: true
Future Use: This enables regeneration, upgrades, and feature addition.
๐ฏ Target Audience #
- Junior developers: who don't yet know how to structure a real project
- Indie devs: who want to spin up production-ready apps quickly
- Small teams: who want standardization without heavy frameworks
๐ง Roadmap #
Phase 1: MVP โ #
- โ CLI tool setup
- โ Basic project generator
- โ Provider template
- โ Theme + routing boilerplate
Phase 2: Multi-Template Support โ #
- โ Riverpod template
- โ Bloc template
- โ Localization integration
- โ API client scaffolding
Phase 3: Platform Expansion โ (v0.4.0) #
- โ Multi-platform support (mobile, web, desktop)
- โ Responsive layout system
- โ Adaptive navigation
- โ Universal project generation
- โ Platform-specific optimizations
Phase 4: Feature Generation โ (v0.3.0) #
- โ
flutter_blueprint add feature <name> - โ Clean architecture layers
- โ Auto-router integration
- โ State management detection
Phase 5: DevOps Integration โ (v0.5.0) #
- โ GitHub Actions CI/CD scaffold
- โ GitLab CI pipelines
- โ Azure Pipelines support
- โ Automated testing & builds
- โ Firebase deployment templates
Phase 6: Future Enhancements ๐ #
- โ Interactive upgrades via
blueprint.yaml - โ Plugin ecosystem (auth, firebase, analytics)
- โ VSCode/IntelliJ extensions
- โ Blueprint dashboard (web-based config UI)
- โ Project migration tools
- โ Custom template support
Hive Offline Caching (NEW) #
- โ Optional Hive integration for generated projects to provide robust offline caching and sync functionality.
- โ
Enables
HiveDatabase,CacheManager, andSyncManagerfiles in generated apps when Hive is enabled viaincludeHive. - CLI usage (planned flag):
flutter_blueprint init my_app --state provider --hiveโ note: the explicit CLI--hiveflag is planned; currently enable Hive programmatically withBlueprintConfig(includeHive: true)or use the helpertools/create_with_hive.dartto generate a sample app. - Programmatic usage:
final config = BlueprintConfig(
appName: 'my_app',
stateManagement: StateManagement.provider,
platforms: [TargetPlatform.mobile],
includeHive: true, // Enable Hive templates
);
- For full implementation details, code samples, and architecture notes see
HIVE_IMPLEMENTATION.mdat the repository root.
๐ค Contributing #
Contributions are welcome! Please read our Contributing Guide first.
- Fork the repo
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
๐ License #
This project is licensed under the MIT License - see the LICENSE file for details.
๐ฌ Support #
- ๐ง Email: [email protected]
- ๐ Issues: GitHub Issues
- ๐ฌ Discussions: GitHub Discussions
๐ Show Your Support #
If this project helped you, please โญ the repository and share it with others!
Made with โค๏ธ for the Flutter community