Skip to main content

A CLI to generate Flutter projects with DDD architecture

Project description

๐Ÿš€ Flutterator

A CLI to generate and manage Flutter projects with DDD (Domain-Driven Design) architecture

Python Flutter License


๐Ÿ“‘ Table of Contents


๐Ÿ“– What is Flutterator?

Flutterator is a command-line tool that automates Flutter project creation following Domain-Driven Design (DDD) architecture best practices.

Instead of manually creating dozens of files for each new feature (entity, repository, bloc, page, dto...), Flutterator generates them automatically with a consistent and professional structure.

๐ŸŽฏ Problem It Solves

Creating a new feature in a Flutter DDD project requires:

  • ๐Ÿ“ Creating 4+ folders (model, infrastructure, application, presentation)
  • ๐Ÿ“„ Creating 10+ Dart files (entity, failure, repository interface, dto, bloc, event, state, page...)
  • โœ๏ธ Writing boilerplate code for each file
  • ๐Ÿ”— Updating the router with new routes
  • โฑ๏ธ Estimated time: 30-60 minutes per feature

With Flutterator:

flutterator add-domain --name todo --fields "title:string,done:bool"
flutterator add-component --name todo_list --type list

Time: 5 seconds โšก

๐Ÿ’ก Who It's For

  • Flutter developers using DDD/Clean Architecture
  • Teams wanting to standardize code structure
  • Freelancers wanting to speed up new project development
  • Students wanting to learn DDD architecture with practical examples

๐Ÿ“ฆ Installation

Requirements

  • Python 3.8+
  • Flutter SDK (for generated projects)

Installation from Source (Recommended)

# 1. Clone the repository
git clone https://github.com/lorenzobusi/flutterator.git
cd flutterator

# 2. Create virtual environment
python -m venv venv
source venv/bin/activate  # Linux/Mac
# or: venv\Scripts\activate  # Windows

# 3. Install dependencies
pip install -e .

# 4. Verify installation
flutterator --help

Installation via pip (when published)

pip install flutterator

Verify Installation

flutterator --help

Expected output:

Usage: flutterator [OPTIONS] COMMAND [ARGS]...

  ๐Ÿš€ Flutterator - Flutter DDD Project Generator
  ...

๐Ÿš€ Quick Start

Scenario 1: New Project

# 1. Create a new Flutter project with DDD structure
flutterator create --name my_app

# 2. Enter the project
cd my_app

# 3. Add a complete feature
flutterator add-domain --name todo --fields "title:string,done:bool,priority:int"
flutterator add-component --name todo_list --type list

# 5. Run the project
flutter run

Scenario 2: Existing Project

# 1. Go to your existing Flutter project
cd my_existing_flutter_app

# 2. Add features
flutterator add-domain --name user --fields "name:string,email:string"
flutterator add-component --name user_list --type list

Scenario 3: Preview Before Creating

# Use --dry-run to see what will be created without modifying anything
flutterator add-domain --name product --fields "name:string,price:double" --dry-run

๐Ÿ“‹ Available Commands

Command Description Typical Use
create Create new Flutter DDD project Project start
add-domain Add domain entity (model, infrastructure) New functionality
add-component Add component (form, list, single) New functionality
add-page Add simple page Static pages
list List project resources Overview
config Manage configuration Customization

๐Ÿ”ง Command Details

flutterator create

Creates a new Flutter project with complete DDD architecture.

Syntax

flutterator create [OPTIONS]

Options

Option Type Required Default Description
--name string โŒ - Project name (snake_case)
--login flag โŒ false Include authentication

Usage Modes

1. Complete command line:

flutterator create --name my_app --login

2. Interactive mode (if you don't specify --name):

flutterator create
Project name: my_app
Does the project have login? [y/N]: y

Examples

# Basic project
flutterator create --name my_app

# Project with authentication
flutterator create --name my_app --login

# Interactive mode (asks for name and options)
flutterator create

Generated Structure

my_app/
โ”œโ”€โ”€ lib/
โ”‚   โ”œโ”€โ”€ core/
โ”‚   โ”‚   โ”œโ”€โ”€ model/              # Value objects, failures, errors
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ value_objects.dart
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ value_failures.dart
โ”‚   โ”‚   โ”‚   โ””โ”€โ”€ value_validators.dart
โ”‚   โ”‚   โ”œโ”€โ”€ infrastructure/     # Firebase modules, helpers
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ firebase_injectable_module.dart
โ”‚   โ”‚   โ”‚   โ””โ”€โ”€ utils.dart
โ”‚   โ”‚   โ””โ”€โ”€ presentation/       # Common widgets
โ”‚   โ”‚       โ””โ”€โ”€ app_widget.dart
โ”‚   โ”œโ”€โ”€ domain/                 # Domain entities (shared business entities)
โ”‚   โ”œโ”€โ”€ features/               # Features (use cases)
โ”‚   โ”‚   โ”œโ”€โ”€ home/
โ”‚   โ”‚   โ”‚   โ””โ”€โ”€ presentation/
โ”‚   โ”‚   โ”‚       โ””โ”€โ”€ home_page.dart
โ”‚   โ”‚   โ””โ”€โ”€ splash/
โ”‚   โ”‚       โ””โ”€โ”€ presentation/
โ”‚   โ”‚           โ””โ”€โ”€ splash_page.dart
โ”‚   โ”œโ”€โ”€ main.dart              # Entry point
โ”‚   โ”œโ”€โ”€ injection.dart         # Dependency injection setup
โ”‚   โ””โ”€โ”€ router.dart            # Routing with auto_route
โ”œโ”€โ”€ pubspec.yaml               # Flutter dependencies
โ”œโ”€โ”€ analysis_options.yaml
โ””โ”€โ”€ ...

flutterator add-domain

Adds a domain entity (model + infrastructure only).

Domain entities are shared business entities that can be used by multiple features. They do NOT include application or presentation layers.

Syntax

flutterator add-domain [OPTIONS]

Options

Option Type Required Default Description
--name string โœ… - Domain entity name
--fields string โŒ - Fields as name:type,name:type
--folder string โŒ from config Domain folder (default: "domain")
--dry-run flag โŒ false Preview without creating
--no-build flag โŒ false Skip flutter pub get
--project-path string โŒ . Project path

Usage Modes

Command line:

flutterator add-domain --name todo --fields "title:string,done:bool,priority:int"

Interactive mode:

flutterator add-domain --name todo
Domain entity name: todo
Fields (name:type,name:type): title:string,done:bool,priority:int

Examples

# Domain entity with fields
flutterator add-domain --name todo --fields "title:string,done:bool,priority:int"

# Interactive mode (will prompt for fields)
flutterator add-domain --name user

# Preview what will be created
flutterator add-domain --name product --fields "name:string,price:double" --dry-run

# Custom domain folder
flutterator add-domain --name note --fields "title:string" --folder shared/domain

Generated Structure

lib/domain/todo/
โ”œโ”€โ”€ model/
โ”‚   โ”œโ”€โ”€ todo.dart
โ”‚   โ”œโ”€โ”€ todo_failure.dart
โ”‚   โ”œโ”€โ”€ i_todo_repository.dart
โ”‚   โ”œโ”€โ”€ value_objects.dart
โ”‚   โ””โ”€โ”€ value_validators.dart
โ””โ”€โ”€ infrastructure/
    โ”œโ”€โ”€ todo_dto.dart
    โ”œโ”€โ”€ todo_service.dart
    โ”œโ”€โ”€ todo_mapper.dart
    โ””โ”€โ”€ todo_repository.dart

flutterator add-page

Adds a simple page without business logic.

Ideal for static pages like About, Settings, Privacy Policy, etc.

Syntax

flutterator add-page [OPTIONS]

Options

Option Type Required Default Description
--name string โœ… - Page name
--folder string โŒ from config Destination folder
--dry-run flag โŒ false Preview without creating
--no-build flag โŒ false Skip flutter pub get
--project-path string โŒ . Project path

Usage Modes

Command line:

flutterator add-page --name settings

Interactive mode:

flutterator add-page
Page name: settings

Examples

# Settings page
flutterator add-page --name settings

# About page with preview
flutterator add-page --name about --dry-run

# Page in specific folder
flutterator add-page --name privacy --folder pages

Generated Structure

lib/features/settings/
โ””โ”€โ”€ settings_page.dart

Also updates:

  • lib/router.dart - Adds the new route

flutterator add-component

Adds a reusable component with optional BLoC.

Supports three types: single (single item), list (list with CRUD), and form (form with validation).

Syntax

flutterator add-component [OPTIONS]

Options

Option Type Required Default Description
--name string โœ… - Component name
--type choice โŒ - Type: form, list, or single
--fields string โŒ - Form fields (requires --type form)
--folder string โŒ features/components Destination folder
--dry-run flag โŒ false Preview without creating
--no-build flag โŒ false Skip flutter pub get

Three Component Types

1. Single Component (--type single or default) - Widget that displays a single item loaded by ID:

flutterator add-component --name user_card
# or
flutterator add-component --name user_card --type single

2. List Component (--type list) - Widget that displays a list of items with complete CRUD operations:

flutterator add-component --name todo_list --type list

3. Form Component (--type form) - Form with validation and field management:

flutterator add-component --name login --type form --fields "email:string,password:string"

Usage Modes

Command line:

# Single component (default)
flutterator add-component --name user_card

# List component
flutterator add-component --name todo_list --type list

# Form component
flutterator add-component --name login --type form --fields "email:string,password:string"

Interactive mode:

flutterator add-component
Component name: todo_list
Select component type:
  1. Single item (loads one item by ID)
  2. List (shows all items with CRUD operations)
  3. Form (form with validation)
Type (1-3): 2

Examples

# Single component (default)
flutterator add-component --name user_card

# List component with complete CRUD
flutterator add-component --name todo_list --type list

# Form component with fields
flutterator add-component --name login --type form --fields "email:string,password:string"

# Component in specific folder
flutterator add-component --name search_bar --folder shared/widgets

# Registration form
flutterator add-component --name registration --type form --fields "name:string,email:string,password:string"

Generated Structure

Single Component:

lib/user_card/
โ”œโ”€โ”€ application/
โ”‚   โ”œโ”€โ”€ user_card_bloc.dart
โ”‚   โ”œโ”€โ”€ user_card_event.dart
โ”‚   โ””โ”€โ”€ user_card_state.dart
โ””โ”€โ”€ presentation/
    โ””โ”€โ”€ user_card_component.dart

List Component:

lib/todo_list/
โ”œโ”€โ”€ application/
โ”‚   โ”œโ”€โ”€ todo_list_bloc.dart      # BLoC with getAll, create, update, delete
โ”‚   โ”œโ”€โ”€ todo_list_event.dart      # loadRequested, createRequested, updateRequested, deleteRequested
โ”‚   โ””โ”€โ”€ todo_list_state.dart      # initial, loading, loaded(List<Model>), error
โ””โ”€โ”€ presentation/
    โ””โ”€โ”€ todo_list_component.dart   # Widget with ListView and CRUD operations

Form Component:

lib/login/
โ”œโ”€โ”€ application/
โ”‚   โ”œโ”€โ”€ login_form_bloc.dart
โ”‚   โ”œโ”€โ”€ login_form_event.dart
โ”‚   โ””โ”€โ”€ login_form_state.dart
โ””โ”€โ”€ presentation/
    โ””โ”€โ”€ login_component.dart



flutterator list

Lists pages and domain models in the project.

Shows all pages parsed from router.dart and all domain models from the domain/ folder.

Syntax

flutterator list [OPTIONS]

Options

Option Type Required Default Description
--project-path string โŒ . Project path

Examples

# List pages and models
flutterator list

Example Output

โ•ญโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฎ
โ”‚ ๐Ÿ“‹ Project: my_app   โ”‚
โ•ฐโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฏ

๐Ÿ“„ Pages:
   /home          โ†’ HomePage        (lib/features/home/home_page.dart)
   /              โ†’ SplashPage      (lib/features/splash/splash_page.dart)
   /settings      โ†’ SettingsPage     (lib/features/settings/settings_page.dart)

๐Ÿ“ฆ Domain Models:
   todo           (lib/domain/todo/model/todo.dart)
   user           (lib/domain/user/model/user.dart)

๐Ÿ“ฆ Features: todo/ โ”œโ”€โ”€ model/ โ”‚ โ”œโ”€โ”€ todo โ”‚ โ””โ”€โ”€ todo_failure โ”œโ”€โ”€ application/ โ”‚ โ””โ”€โ”€ todo_bloc โ””โ”€โ”€ presentation/ โ””โ”€โ”€ todo_page

user/ โ”œโ”€โ”€ model/ โ”‚ โ”œโ”€โ”€ user โ”‚ โ””โ”€โ”€ user_failure ...

๐Ÿ“„ Pages: settings/ (1 file) about/ (1 file)

๐Ÿงฉ Components: user_card/ (standard) login/ (form)

๐Ÿ›ค๏ธ Routes: /home โ†’ HomePage /todo โ†’ TodoPage /settings โ†’ SettingsPage /user โ†’ UserPage


---

### `flutterator config`

**Manages Flutterator configuration.**

Allows viewing or creating the configuration file.

#### Syntax

```bash
flutterator config [OPTIONS]

Options

Option Type Description
--show flag Show current configuration
--init flag Create configuration file
--project-path string Project path

Examples

# Show current configuration
flutterator config --show

# Create configuration file
flutterator config --init

Output --show

โ•ญโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ โš™๏ธ  Configuration โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฎ
โ”‚ โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”ณโ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”“                         โ”‚
โ”‚ โ”ƒ Setting             โ”ƒ Value         โ”ƒ                         โ”‚
โ”‚ โ”กโ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ•‡โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”ฉ                         โ”‚
โ”‚ โ”‚ Feature Folder      โ”‚ features      โ”‚                         โ”‚
โ”‚ โ”‚ Component Folder    โ”‚ components    โ”‚                         โ”‚
โ”‚ โ”‚ Page Folder         โ”‚               โ”‚                         โ”‚
โ”‚ โ”‚ Use BLoC            โ”‚ โœ…            โ”‚                         โ”‚
โ”‚ โ”‚ Use Freezed         โ”‚ โœ…            โ”‚                         โ”‚
โ”‚ โ”‚ Auto Build Runner   โ”‚ โœ…            โ”‚                         โ”‚
โ”‚ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜                         โ”‚
โ•ฐโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฏ

๐Ÿ“„ Project config: /path/to/project/flutterator.yaml

๐Ÿƒ Global Flags

These flags are available for all add-* commands:

Flag Description Example
--dry-run Preview without creating files --dry-run
--no-build Skip flutter pub get and build_runner --no-build
--project-path Specify project path --project-path ../app

--dry-run Example

$ flutterator add-domain --name todo --fields "title:string" --dry-run
$ flutterator add-component --name todo_list --type list --dry-run

Output:

โ•ญโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฎ
โ”‚ ๐Ÿ” DRY-RUN MODE          โ”‚
โ”‚ No files will be created โ”‚
โ•ฐโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฏ

๐Ÿ”ง Would add feature: todo
   Fields: id:string

๐Ÿ“ lib/todo/
โ”œโ”€โ”€ ๐Ÿ“ model/
โ”‚   โ”œโ”€โ”€ ๐Ÿ“„ todo.dart
โ”‚   โ”œโ”€โ”€ ๐Ÿ“„ todo_failure.dart
โ”‚   โ”œโ”€โ”€ ๐Ÿ“„ i_todo_repository.dart
โ”‚   โ””โ”€โ”€ ...
โ”œโ”€โ”€ ๐Ÿ“ infrastructure/
โ”‚   โ””โ”€โ”€ ...
โ”œโ”€โ”€ ๐Ÿ“ application/
โ”‚   โ””โ”€โ”€ ...
โ””โ”€โ”€ ๐Ÿ“ presentation/
    โ””โ”€โ”€ ๐Ÿ“„ todo_page.dart

๐Ÿ“ Would update: lib/router.dart

โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
โ„น๏ธ  Run without --dry-run to create these files

--no-build Example

# Faster: skip pub get and build_runner
flutterator add-domain --name todo --fields "title:string" --no-build
flutterator add-component --name todo_list --type list --no-build

# Then run manually when you want
flutter pub get
dart run build_runner build --delete-conflicting-outputs

โš™๏ธ Configuration

Configuration Priority

Flutterator loads configuration from multiple sources (in priority order):

  1. ๐Ÿ”ด CLI Flags (highest priority) - --folder features
  2. ๐ŸŸ  flutterator.yaml in project
  3. ๐ŸŸก ~/.flutteratorrc global (home directory)
  4. ๐ŸŸข Defaults (lowest priority)

Create Configuration

# Create flutterator.yaml in project
flutterator config --init

flutterator.yaml Example

# ๐Ÿ“ Default folders for generated code
defaults:
  feature_folder: "features"     # lib/features/todo/
  domain_folder: "domain"         # lib/domain/note/ (shared entities)
  component_folder: "features/components" # lib/features/components/user_card/
  auto_run_build_runner: true    # Runs build_runner after generation

# ๐ŸŽจ UI Configuration (for future reference)
styling:
  primary_color: "#2196F3"
  secondary_color: "#FF9800"

~/.flutteratorrc Example (Global)

# Global configuration for all projects
defaults:
  feature_folder: "features"
  auto_run_build_runner: false  # Disable for all projects

๐Ÿ—๏ธ Generated Architecture

Flutterator generates projects following DDD (Domain-Driven Design) architecture with layer separation:

lib/
โ”œโ”€โ”€ core/                        # ๐Ÿ”ง CORE - Shared code
โ”‚   โ”œโ”€โ”€ model/                   # Value objects, common failures
โ”‚   โ”‚   โ”œโ”€โ”€ value_objects.dart
โ”‚   โ”‚   โ”œโ”€โ”€ value_failures.dart
โ”‚   โ”‚   โ””โ”€โ”€ value_validators.dart
โ”‚   โ”œโ”€โ”€ infrastructure/          # DI modules, helpers
โ”‚   โ”‚   โ””โ”€โ”€ firebase_injectable_module.dart
โ”‚   โ””โ”€โ”€ presentation/            # Common widgets
โ”‚       โ””โ”€โ”€ app_widget.dart
โ”‚
โ”œโ”€โ”€ domain/                      # ๐Ÿ›๏ธ DOMAIN ENTITIES - Shared entities
โ”‚   โ”œโ”€โ”€ auth/                    # Auth entity (shared)
โ”‚   โ”‚   โ”œโ”€โ”€ model/               # Entity, failures, repository interface
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ user.dart
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ user_profile.dart
โ”‚   โ”‚   โ”‚   โ””โ”€โ”€ i_auth_facade.dart
โ”‚   โ”‚   โ””โ”€โ”€ infrastructure/      # Repository implementation, DTOs
โ”‚   โ”‚       โ”œโ”€โ”€ firebase_auth_facade.dart
โ”‚   โ”‚       โ””โ”€โ”€ user_profile_repository.dart
โ”‚   โ”‚
โ”‚   โ””โ”€โ”€ note/                    # Example: Note entity (shared)
โ”‚       โ”œโ”€โ”€ model/
โ”‚       โ”‚   โ”œโ”€โ”€ note.dart
โ”‚       โ”‚   โ””โ”€โ”€ i_note_repository.dart
โ”‚       โ””โ”€โ”€ infrastructure/
โ”‚           โ””โ”€โ”€ note_repository.dart
โ”‚
โ”œโ”€โ”€ features/                    # ๐Ÿ“ฆ FEATURES - Specific use cases
โ”‚   โ”œโ”€โ”€ auth/                    # Auth feature (complete use case)
โ”‚   โ”‚   โ”œโ”€โ”€ application/         # โš™๏ธ APPLICATION LAYER
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ auth_bloc.dart
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ auth_event.dart
โ”‚   โ”‚   โ”‚   โ””โ”€โ”€ auth_state.dart
โ”‚   โ”‚   โ””โ”€โ”€ presentation/        # ๐ŸŽจ PRESENTATION LAYER
โ”‚   โ”‚       โ””โ”€โ”€ login_page.dart
โ”‚   โ”‚
โ”‚   โ””โ”€โ”€ notes/                    # Example feature "note management"
โ”‚       โ”‚                          # (uses domain/note)
โ”‚       โ”œโ”€โ”€ application/         # โš™๏ธ APPLICATION LAYER
โ”‚       โ”‚   โ”œโ”€โ”€ notes_bloc.dart      # BLoC (logic)
โ”‚       โ”‚   โ”œโ”€โ”€ notes_event.dart     # Events
โ”‚       โ”‚   โ””โ”€โ”€ notes_state.dart     # States
โ”‚       โ”‚
โ”‚       โ””โ”€โ”€ presentation/        # ๐ŸŽจ PRESENTATION LAYER
โ”‚           โ””โ”€โ”€ notes_page.dart      # UI
โ”‚
โ”œโ”€โ”€ shared/                      # ๐Ÿงฉ SHARED - Shared components
โ”‚   โ””โ”€โ”€ widgets/
โ”‚
โ”œโ”€โ”€ main.dart                    # Entry point
โ”œโ”€โ”€ injection.dart               # ๐Ÿ’‰ Dependency Injection
โ””โ”€โ”€ router.dart                  # ๐Ÿ›ค๏ธ Routing (auto_route)

Why DDD?

Benefit Description
Testability Each layer is isolated and testable
Maintainability Organized and predictable code
Scalability Easy to add new features
Team Multiple developers can work in parallel

๐Ÿ“š Flutter Generated Dependencies

Generated projects use these standard Flutter dependencies:

Package Purpose Link
flutter_bloc State management pub.dev
freezed Immutable classes pub.dev
injectable Dependency injection pub.dev
auto_route Declarative routing pub.dev
dartz Functional programming pub.dev
json_annotation JSON serialization pub.dev

๐Ÿงช Testing

# Activate virtual environment
source venv/bin/activate

# Run all tests
pytest tests/ -v

# Only fast tests (without E2E)
pytest tests/test_basic.py tests/test_integration.py -v

# Only E2E tests (requires Flutter SDK installed)
pytest tests/test_e2e_flutter.py -v

# With coverage
pytest tests/ --cov=. --cov-report=html

๐Ÿ”ง Troubleshooting

"Command not found: flutterator"

# Make sure you installed correctly
pip install -e .

# Or use python directly
python flutterator.py --help

flutterator --help shows only "create" (no add-domain, add-page, etc.)

You are using an old or different installation of Flutterator that only exposes the create command. The full CLI is a group of commands: create, add-domain, add-page, add-component, list, config.

Fix:

  1. Check which executable runs: which flutterator
  2. Use the CLI from this repo:
    cd /path/to/flutterator   # this repo root
    python3 flutterator.py --help
    
    You should see "Usage: flutterator [OPTIONS] COMMAND [ARGS]..." and the list of commands.
  3. Either:
    • Option A: Remove or rename the old flutterator from your PATH, then install from this repo: pip install -e . (requires pip โ‰ฅ 21.3), or
    • Option B: Add an alias so the repoโ€™s CLI wins:
      alias flutterator='python3 /path/to/flutterator/flutterator.py'
      
      (Replace /path/to/flutterator with the real path to this repo.)

"Not a valid Flutter project"

# Flutterator requires pubspec.yaml and lib/
# Make sure you're in a valid Flutter project
ls pubspec.yaml lib/

"rich import error" in IDE

The IDE might not recognize the virtual environment. Solution:

  1. Cmd+Shift+P โ†’ "Python: Select Interpreter"
  2. Select ./venv/bin/python

build_runner slow

# Use --no-build to skip build_runner
flutterator add-domain --name todo --fields "title:string" --no-build
flutterator add-component --name todo_list --type list --no-build

# Run build_runner once at the end
dart run build_runner build --delete-conflicting-outputs

Dart compilation errors

After generating code, run:

flutter pub get
dart run build_runner build --delete-conflicting-outputs

๐Ÿค Contributing

  1. Fork the repository
  2. Create branch: git checkout -b feature/new-feature
  3. Commit: git commit -m 'Add new feature'
  4. Push: git push origin feature/new-feature
  5. Open Pull Request

Project Structure

flutterator/
โ”œโ”€โ”€ flutterator.py              # Main CLI
โ”œโ”€โ”€ generators/
โ”‚   โ”œโ”€โ”€ helpers/                # Helper functions
โ”‚   โ”‚   โ”œโ”€โ”€ config.py           # Configuration management
โ”‚   โ”‚   โ””โ”€โ”€ project.py          # Project validation
โ”‚   โ””โ”€โ”€ static/templates/       # Jinja2 templates
โ”œโ”€โ”€ tests/                      # Test suite
โ””โ”€โ”€ docs/                       # Documentation

๐Ÿ“„ License

MIT License - see LICENSE


๐Ÿ‘จโ€๐Ÿ’ป Author

Lorenzo Busi - GetAutomation


๐Ÿ™ Acknowledgments


Generated with โค๏ธ by Flutterator

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

flutterator-3.1.4.tar.gz (242.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

flutterator-3.1.4-py3-none-any.whl (259.9 kB view details)

Uploaded Python 3

File details

Details for the file flutterator-3.1.4.tar.gz.

File metadata

  • Download URL: flutterator-3.1.4.tar.gz
  • Upload date:
  • Size: 242.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for flutterator-3.1.4.tar.gz
Algorithm Hash digest
SHA256 365b2c76608dd7393aa6faef77e778a69e8a50e7c6f138f934faebf856034876
MD5 03c41c9d84387b18e49b57c4c200e1a2
BLAKE2b-256 cf8c5bd92276d1f7d05e30652cd4da5167f20c16fcb699ddc5c12c392b64d7e2

See more details on using hashes here.

Provenance

The following attestation bundles were made for flutterator-3.1.4.tar.gz:

Publisher: publish-pypi.yml on lorenzo9598/flutterator

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file flutterator-3.1.4-py3-none-any.whl.

File metadata

  • Download URL: flutterator-3.1.4-py3-none-any.whl
  • Upload date:
  • Size: 259.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for flutterator-3.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 13f19a6837669086e8ce8195289c93feb4f1e4e26cf86f197ace5d867552ae7f
MD5 f19a44eab4ee2ef769b872b6c153ec2b
BLAKE2b-256 deb37431423cfde0dd85a6635620980676d3446bf53f0108a9190bd74adfc0e0

See more details on using hashes here.

Provenance

The following attestation bundles were made for flutterator-3.1.4-py3-none-any.whl:

Publisher: publish-pypi.yml on lorenzo9598/flutterator

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page