save_points_flutter_template_builder 1.0.0+3 copy "save_points_flutter_template_builder: ^1.0.0+3" to clipboard
save_points_flutter_template_builder: ^1.0.0+3 copied to clipboard

A powerful CLI tool to generate Flutter projects with custom folder structure, themes, core files, and code generation capabilities (models, states, blocs, notifiers, repositories).

Save Points Flutter Template Builder #

A powerful CLI tool to generate Flutter projects with custom folder structure, themes, core files, and code generation capabilities.

Screenshots #

Example App Screenshot 1

Example App Screenshot 2


πŸ’‘ Coming Soon: Ψ¨Ω„Ψ§Ψ΄ Ψ₯Ω†Ψ―Ω‡Ψ§Ψ΄ Ω„Ψ³Ω‡ Ψ§Ω„ΨͺΩ‚ΩŠΩ„ Ω…Ψ¬Ψ§Ψ΄ πŸš€
More exciting features and improvements are on the way! Stay tuned for updates.

Features #

  • πŸš€ Generates Flutter projects with a clean, organized structure
  • 🎨 Pre-configured themes (light & dark mode) with easy localization
  • πŸ“ Custom folder structure (core/, models/, states/, blocs/, notifiers/, repositories/, etc.)
  • πŸ“ Pre-built core files (app_theme.dart, app_colors.dart, routes.dart, etc.)
  • πŸ”§ Code Generation: Generate models, states, blocs, notifiers, and repositories
  • πŸ“¦ Android Production Ready: Automated keystore generation and signing configuration
  • 🎯 State Management: Support for Bloc and Riverpod patterns
  • πŸ”„ JSON Serialization: Auto-generated toJson/fromJson with Equatable
  • 🌍 Localization: Built-in support for easy_localization with Arabic and English
  • πŸ“š Reusable Widgets: 20+ pre-built common widgets
  • πŸ› οΈ Utilities: Extensions, helpers, validators, and date formatters
  • πŸ” Dry-run mode for previewing changes
  • πŸ“Š Progress indicators for long operations
  • πŸ” Security policy and responsible disclosure
  • πŸ“š Comprehensive documentation and contribution guidelines

Installation #

Local Development #

  1. Clone this repository

  2. Install dependencies:

    dart pub get
    
  3. Run the CLI:

    dart run bin/save_points_flutter_template_builder.dart create my_app
    

Global Installation (After Publishing) #

Once published to pub.flutter-io.cn, you can install it globally:

dart pub global activate save_points_flutter_template_builder

Then use it from anywhere:

save_points_flutter_template_builder create my_app

Usage #

Create Project #

# Create a new Flutter project
dart run save_points_flutter_template_builder:create my_app

# Or if installed globally
save_points_flutter_template_builder create my_app

# Interactive mode (prompts for project name and namespace)
save_points_flutter_template_builder create --interactive

# Create with Android production setup
save_points_flutter_template_builder create my_app --android-production

# Dry run mode (preview changes without creating files)
save_points_flutter_template_builder create my_app --dry-run

# Overwrite existing directory
save_points_flutter_template_builder create my_app --force

# Use custom config file
save_points_flutter_template_builder create my_app --config ./builder.yaml

Generate Code #

# Generate model class with JSON serialization
save_points_flutter_template_builder model User --interactive
save_points_flutter_template_builder model Product --fields "id:int:false,name:String:false,price:double:false"

# Generate state class for state management
save_points_flutter_template_builder state AuthState --interactive
save_points_flutter_template_builder state ProductState --fields "data:Product?:true,error:String?:true" --include-states "initial,loading,success,error"

# Generate Riverpod notifier
save_points_flutter_template_builder notifier AuthNotifier --interactive
save_points_flutter_template_builder notifier ProductNotifier --state ProductState

# Generate Bloc with events
save_points_flutter_template_builder bloc AuthBloc --interactive
save_points_flutter_template_builder bloc ProductBloc --state ProductState --events "Load,Refresh,Error"

# Generate repository for data access
save_points_flutter_template_builder repository UserRepository --interactive
save_points_flutter_template_builder repository ProductRepository --model Product --methods "getAll,getById,create,update,delete"

Android Production Setup #

# Prepare Android for production (interactive mode)
save_points_flutter_template_builder prepare-android --interactive

# Prepare Android for production (non-interactive, uses defaults)
save_points_flutter_template_builder prepare-android

# Prepare Android for production in specific project
save_points_flutter_template_builder prepare-android --path /path/to/project

Other Commands #

# Check version
save_points_flutter_template_builder --version

# Show help
save_points_flutter_template_builder --help
save_points_flutter_template_builder <command> --help

Generated Project Structure #

my_app/
β”œβ”€β”€ lib/
β”‚   β”œβ”€β”€ core/
β”‚   β”‚   β”œβ”€β”€ constants/
β”‚   β”‚   β”‚   β”œβ”€β”€ app_constants.dart
β”‚   β”‚   β”‚   └── app_strings.dart
β”‚   β”‚   β”œβ”€β”€ config/
β”‚   β”‚   β”‚   └── app_config.dart
β”‚   β”‚   β”œβ”€β”€ network/
β”‚   β”‚   β”‚   β”œβ”€β”€ api_consumer.dart
β”‚   β”‚   β”‚   β”œβ”€β”€ dio_api_consumer.dart
β”‚   β”‚   β”‚   └── http_api_consumer.dart
β”‚   β”‚   β”œβ”€β”€ services/
β”‚   β”‚   β”‚   └── example_service.dart
β”‚   β”‚   β”œβ”€β”€ style/
β”‚   β”‚   β”‚   β”œβ”€β”€ app_theme.dart
β”‚   β”‚   β”‚   β”œβ”€β”€ app_colors.dart
β”‚   β”‚   β”‚   β”œβ”€β”€ app_text_styles.dart
β”‚   β”‚   β”‚   β”œβ”€β”€ app_light_theme.dart
β”‚   β”‚   β”‚   └── app_dark_theme.dart
β”‚   β”‚   β”œβ”€β”€ utils/
β”‚   β”‚   β”‚   β”œβ”€β”€ validators.dart
β”‚   β”‚   β”‚   β”œβ”€β”€ extensions.dart
β”‚   β”‚   β”‚   β”œβ”€β”€ helpers.dart
β”‚   β”‚   β”‚   β”œβ”€β”€ date_formatter.dart
β”‚   β”‚   β”‚   β”œβ”€β”€ error_handler.dart
β”‚   β”‚   β”‚   └── logger_service.dart
β”‚   β”‚   └── widgets/
β”‚   β”‚       β”œβ”€β”€ app_button.dart
β”‚   β”‚       β”œβ”€β”€ app_card.dart
β”‚   β”‚       β”œβ”€β”€ app_dialog.dart
β”‚   β”‚       β”œβ”€β”€ app_text_field.dart
β”‚   β”‚       └── ... (20+ reusable widgets)
β”‚   β”œβ”€β”€ models/          # Generated model classes
β”‚   β”œβ”€β”€ states/          # Generated state classes
β”‚   β”œβ”€β”€ blocs/           # Generated bloc classes
β”‚   β”œβ”€β”€ notifiers/       # Generated notifier classes
β”‚   β”œβ”€β”€ repositories/    # Generated repository classes
β”‚   β”œβ”€β”€ screens/
β”‚   β”‚   β”œβ”€β”€ home/
β”‚   β”‚   β”œβ”€β”€ login/
β”‚   β”‚   β”œβ”€β”€ register/
β”‚   β”‚   └── ...
β”‚   β”œβ”€β”€ routes/
β”‚   β”‚   β”œβ”€β”€ app_routes.dart
β”‚   β”‚   └── route_generator.dart
β”‚   └── main.dart
β”œβ”€β”€ assets/
β”‚   β”œβ”€β”€ translations/
β”‚   β”‚   β”œβ”€β”€ en.json
β”‚   β”‚   └── ar.json
β”‚   └── icons/
└── android/
    β”œβ”€β”€ keystore.properties  # (if Android production setup)
    └── app/
        └── proguard-rules.pro

Generated Files #

Core Files #

  • app_constants.dart: Application-wide constants (API URLs, timeouts, etc.)
  • app_strings.dart: String constants for the app
  • app_colors.dart: Color palette for the app
  • app_theme.dart: Light and dark theme configurations
  • app_config.dart: Environment-based configuration
  • app_routes.dart: Route name constants
  • route_generator.dart: Route generation logic

Utilities #

  • validators.dart: Form validation utilities (email, phone, password, etc.)
  • extensions.dart: Extension methods for BuildContext, String, DateTime, List, etc.
  • helpers.dart: Helper functions (formatting, clipboard, keyboard, device detection)
  • date_formatter.dart: Date formatting utilities
  • error_handler.dart: Error handling utilities
  • logger_service.dart: Logging service

Widgets #

20+ reusable widgets including:

  • app_button.dart: Custom button widget
  • app_card.dart: Card widget
  • app_dialog.dart: Dialog widget
  • app_text_field.dart: Text field with validation
  • app_snackbar.dart: Snackbar widget
  • app_avatar.dart: Avatar widget
  • app_badge.dart: Badge widget
  • And many more...

Code Generation #

Models

  • Generates model classes with toJson() and fromJson() methods
  • Includes copyWith() method for immutable updates
  • Uses Equatable for value equality
  • Supports all common types (String, int, double, bool, DateTime, List, Map)

States

  • Generates state classes extending Equatable
  • Factory constructors for different state types (initial, loading, success, error)
  • copyWith() method for state updates

Notifiers (Riverpod)

  • Generates StateNotifier classes
  • Creates StateNotifierProvider
  • Common state management methods (reset, setLoading, setSuccess, setError)

Blocs

  • Generates Bloc classes with event handling
  • Creates event classes extending Equatable
  • Event handlers with TODO comments for implementation

Repositories

  • Generates repository classes with CRUD methods
  • Uses ApiConsumer for API communication
  • Error handling and model serialization
  • Configurable base path for API endpoints

Main.dart #

The generated main.dart includes:

  • MaterialApp with theme configuration
  • Route generation setup
  • Localization setup with easy_localization
  • Proper app structure

Dependencies #

The generated projects include these dependencies:

  • http: ^1.2.2 - HTTP client
  • dio: ^5.5.0 - Powerful HTTP client
  • flutter_dotenv: ^6.0.0 - Environment variables
  • package_info_plus: ^9.0.0 - Package information
  • flutter_secure_storage: ^9.2.2 - Secure storage
  • easy_localization: ^3.0.8 - Localization
  • save_points_intl: ^1.0.1 - Internationalization
  • equatable: ^2.0.5 - Value equality
  • flutter_riverpod: ^3.0.3 - State management (Riverpod)
  • flutter_bloc: ^9.1.1 - State management (Bloc)

Customization #

To customize the generated templates, edit the files in:

  • lib/src/templates/templates/ - Template content files

Each template is a separate Dart file with a static content getter, making it easy to maintain and refactor.

Customizing Generated Code #

All code generation commands support interactive mode where you can:

  • Specify field names and types
  • Choose which methods to include
  • Configure state types and events
  • Customize file locations

Development #

Project Structure #

lib/
β”œβ”€β”€ src/
β”‚   β”œβ”€β”€ commands/          # CLI commands
β”‚   β”‚   β”œβ”€β”€ create_command.dart
β”‚   β”‚   β”œβ”€β”€ model_command.dart
β”‚   β”‚   β”œβ”€β”€ state_command.dart
β”‚   β”‚   β”œβ”€β”€ notifier_command.dart
β”‚   β”‚   β”œβ”€β”€ bloc_command.dart
β”‚   β”‚   β”œβ”€β”€ repository_command.dart
β”‚   β”‚   └── prepare_android_command.dart
β”‚   β”œβ”€β”€ generator/         # Project generation logic
β”‚   β”‚   β”œβ”€β”€ android/       # Android production helpers
β”‚   β”‚   β”‚   β”œβ”€β”€ keystore_manager.dart
β”‚   β”‚   β”‚   β”œβ”€β”€ build_gradle_configurator.dart
β”‚   β”‚   β”‚   β”œβ”€β”€ proguard_configurator.dart
β”‚   β”‚   β”‚   └── gradle_properties_configurator.dart
β”‚   β”‚   └── templates/     # Code generation templates
β”‚   β”œβ”€β”€ templates/         # Template files
β”‚   β”‚   β”œβ”€β”€ templates/     # Individual template content
β”‚   β”‚   └── assets/        # Asset templates (translations, icons)
β”‚   └── utils/             # Utility classes
└── bin/
    └── save_points_flutter_builder.dart  # CLI entry point

Adding New Templates #

  1. Create a new template file in lib/src/templates/templates/
  2. Add a class with a static content getter
  3. Register it in template_loader.dart
  4. Add the generation logic in template_processor.dart

Adding New Code Generators #

  1. Create a new command in lib/src/commands/
  2. Create a template generator in lib/src/generator/templates/
  3. Register the command in bin/save_points_flutter_builder.dart
  4. Add the command to the commands barrel file

Quick Examples #

Complete Workflow Example #

# 1. Create a new Flutter project with Android production setup
save_points_flutter_template_builder create my_ecommerce_app --android-production --interactive

# 2. Generate a Product model
save_points_flutter_template_builder model Product --fields "id:int:false,name:String:false,price:double:false,description:String?:true"

# 3. Generate a ProductState
save_points_flutter_template_builder state ProductState --fields "products:List<Product>?:true,error:String?:true,isLoading:bool:false" --include-states "initial,loading,success,error"

# 4. Generate a ProductBloc
save_points_flutter_template_builder bloc ProductBloc --state ProductState --events "LoadProducts,RefreshProducts,Error"

# 5. Generate a ProductRepository
save_points_flutter_template_builder repository ProductRepository --model Product --methods "getAll,getById,create,update,delete"

State Management Setup Example #

# For Riverpod
save_points_flutter_template_builder state AuthState --interactive
save_points_flutter_template_builder notifier AuthNotifier --state AuthState

# For Bloc
save_points_flutter_template_builder state AuthState --interactive
save_points_flutter_template_builder bloc AuthBloc --state AuthState --events "Login,Logout,CheckAuth"

Testing #

Run the test suite:

# Run all tests
dart test

# Run tests with coverage
dart test --coverage=coverage

# Generate coverage report
dart pub global activate coverage
dart pub global run coverage:format_coverage \
  --lcov \
  --in=coverage \
  --out=coverage/lcov.info \
  --packages=.dart_tool/package_config.json \
  --report-on=lib

Contributing #

We welcome contributions! Please see CONTRIBUTING.md for guidelines.

Security #

For security vulnerabilities, please see SECURITY.md.

License #

MIT

Support #

0
likes
80
points
0
downloads

Publisher

unverified uploader

Weekly Downloads

A powerful CLI tool to generate Flutter projects with custom folder structure, themes, core files, and code generation capabilities (models, states, blocs, notifiers, repositories).

Repository (GitHub)
View/report issues

Topics

#flutter #cli #code-generation #template #state-management

Documentation

API reference

License

MIT (license)

Dependencies

args, dio, easy_localization, equatable, flutter, flutter_bloc, flutter_dotenv, flutter_riverpod, http, package_info_plus, path, save_points_intl, yaml, yaml_edit

More

Packages that depend on save_points_flutter_template_builder