save_points_flutter_template_builder 1.0.0+3
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 #


π‘ 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 #
-
Clone this repository
-
Install dependencies:
dart pub get -
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()andfromJson()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 #
- Create a new template file in
lib/src/templates/templates/ - Add a class with a static
contentgetter - Register it in
template_loader.dart - Add the generation logic in
template_processor.dart
Adding New Code Generators #
- Create a new command in
lib/src/commands/ - Create a template generator in
lib/src/generator/templates/ - Register the command in
bin/save_points_flutter_builder.dart - 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 #
- π Documentation
- π Report a Bug
- π‘ Request a Feature