flutter_blueprint 0.2.0-dev.2 copy "flutter_blueprint: ^0.2.0-dev.2" to clipboard
flutter_blueprint: ^0.2.0-dev.2 copied to clipboard

Smart Flutter app scaffolding CLI with architecture, theming, routing, and environment handling built-in.

๐ŸŽฏ 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.

Pub Version License: MIT

๐Ÿš€ 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-43 files in seconds
๐Ÿงฑ Clean architecture Separation of concerns (core/, features/, app/) Professional folder structure
๐ŸŽฏ State management Provider OR Riverpod (Bloc coming soon) Choose your preferred pattern
๐ŸŽจ Theming system Material 3 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

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

๐Ÿ“ฆ Installation #

dart pub global activate flutter_blueprint

Then use it anywhere:

flutter_blueprint init my_app

Local Execution #

dart run flutter_blueprint init my_app

๐ŸŽฌ Quick Start #

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

๐Ÿ“‹ Configuration Summary:
   App name: my_awesome_app
   State management: provider
   Theme: โœ…
   Localization: โœ…
   Environment: โœ…
   API client: โœ…
   Tests: โœ…

โœ” ๐Ÿš€ 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

Hybrid Mode (Mix Both) #

flutter_blueprint init my_app --state riverpod
# Prompts for remaining options

๐ŸŽฏ 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 ProviderContainer for 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
โ”‚   โ”‚   โ”œโ”€โ”€ 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
  • Full Stack (all features enabled): 43 files ๐Ÿš€

๐Ÿง  Architecture Principles #

Clean Separation of Concerns #

  • core/: Shared infrastructure (config, theme, routing, API)
  • features/: Business logic organized by feature
  • app/: 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
--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
-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.yaml and emits matching files for Provider, Riverpod, or Bloc.
  • If app_router.dart exists, the generator will add the page import, a route constant to RouteNames, and a case in 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
platform: mobile
state_management: provider
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 โœ… (Current) #

  • โœ… 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: Feature Generation #

  • โŒ flutter_blueprint add feature <name>
  • โŒ Interactive upgrades via blueprint.yaml
  • โŒ Unit + widget test templates

Phase 4: Advanced Features #

  • โŒ Plugin ecosystem (auth, firebase, analytics)
  • โŒ GitHub Actions CI scaffold
  • โŒ Web/desktop platform support
  • โŒ Blueprint dashboard (web-based config UI)

๐Ÿค Contributing #

Contributions are welcome! Please read our Contributing Guide first.

  1. Fork the repo
  2. Create your feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

๐Ÿ“„ License #

This project is licensed under the MIT License - see the LICENSE file for details.


๐Ÿ’ฌ Support #


๐ŸŒŸ Show Your Support #

If this project helped you, please โญ the repository and share it with others!


Made with โค๏ธ for the Flutter community

5
likes
0
points
206
downloads

Publisher

unverified uploader

Weekly Downloads

Smart Flutter app scaffolding CLI with architecture, theming, routing, and environment handling built-in.

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

args, interact, mustache_template, path, yaml

More

Packages that depend on flutter_blueprint