flutter_architecture_generator 1.2.4 copy "flutter_architecture_generator: ^1.2.4" to clipboard
flutter_architecture_generator: ^1.2.4 copied to clipboard

A CLI tool to scaffold professional Flutter projects with Clean, MVVM, BLoC, GetX, or Provider architecture plus DI, routing, and tests.

example/flutter_architecture_generator_example.dart

/// # Flutter Architecture Generator — Example Usage
///
library;

///
/// This package is a CLI tool and is intended to be activated globally.
///
/// ## Installation
///
/// ```bash
/// dart pub global activate flutter_architecture_generator
/// ```
///
/// ## Quick Start
///
/// ### 1. Initialize a new project architecture
///
/// Navigate to your Flutter project root and run:
///
/// ```bash
/// flutter_arch_gen init
/// ```
///
/// This will interactively prompt you to select:
/// - **State Management**: BLoC, Riverpod, Provider, or GetX
/// - **Routing**: GoRouter or AutoRoute
/// - **Localization**: Enable/disable L10n support
/// - **Firebase**: Enable/disable Firebase integration
/// - **Tests**: Enable/disable test scaffolding
///
/// ### 2. Generate a feature
///
/// ```bash
/// flutter_arch_gen feature user_profile
/// ```
///
/// This creates a complete Clean Architecture feature with:
/// - Domain layer (entity, repository interface, use case)
/// - Data layer (model, data source, repository implementation)
/// - Presentation layer (page, state management)
/// - Auto-registers in DI container and router
///
/// ### 3. Generate a model
///
/// ```bash
/// flutter_arch_gen model Product -f shop
/// ```
///
/// Generates a Freezed model inside the specified feature.
///
/// ### 4. Generate a page
///
/// ```bash
/// flutter_arch_gen page settings -f settings
/// ```
///
/// Generates a StatelessWidget page and auto-registers it in the router.
///
/// ### 5. Generate from API
///
/// ```bash
/// flutter_arch_gen api Product --url https://fakestoreapi.com/products/1 --feature shop
/// ```
///
/// Fetches JSON from the URL, creates a Model with inferred types, a Service, and a Repository.
///
/// ## Programmatic Usage
///
/// You can also use the runner programmatically:

import 'package:flutter_architecture_generator/flutter_architecture_generator.dart';

Future<void> main() async {
  // Create the CLI runner
  final runner = FlutterArchGenRunner();

  // Run with arguments — same as CLI usage
  // Example: Initialize a project
  await runner.run(['init']);

  // Example: Generate a feature
  await runner.run(['feature', 'products']);

  // Example: Generate a model inside a feature
  await runner.run(['model', 'Product', '-f', 'products']);

  // Example: Generate a standalone page
  await runner.run(['page', 'About']);

  // Example: Generate from API
  await runner.run([
    'api',
    'Product',
    '--url',
    'https://fakestoreapi.com/products/1',
    '--feature',
    'shop'
  ]);
}
1
likes
160
points
363
downloads

Documentation

API reference

Publisher

verified publisheracrocoder.com

Weekly Downloads

A CLI tool to scaffold professional Flutter projects with Clean, MVVM, BLoC, GetX, or Provider architecture plus DI, routing, and tests.

Repository (GitHub)
View/report issues

Topics

#cli #clean-architecture #code-generation #scaffolding #flutter

License

MIT (license)

Dependencies

args, mason_logger, path, yaml, yaml_edit

More

Packages that depend on flutter_architecture_generator