Flutter App Generator

A powerful CLI tool for generating production-ready Flutter applications with pre-configured dependencies, Firebase integration, localization, and platform-specific configurations.

Features

  • ๐Ÿš€ Quick Setup: Creates a complete Flutter app with a single command
  • ๐Ÿ”ฅ Firebase Integration: Optional Firebase setup with authentication, Firestore, and analytics
  • ๐ŸŒ Localization Ready: Pre-configured internationalization support
  • ๐Ÿ“ฑ Multi-Platform: Supports iOS, Android, and Web with platform-specific configurations
  • ๐ŸŽจ Modern Architecture: Includes app structure with themes, routing, and constants
  • ๐Ÿ“ฆ Essential Dependencies: Pre-configured with commonly used packages
  • ๐Ÿงน Clean Code: Removes default Flutter lints and uses very_good_analysis
  • โšก Enhanced Main: Optional enhanced main.dart with error handling and logging

Installation

dart pub global activate flutter_app_generator

After activation, you can run the tool from anywhere:

flutter_app_generator -n MyApp

Option 2: Install from source

git clone https://github.com/shebnik/flutter_app_generator.git
cd flutter_app_generator
dart pub global activate --source path .

Option 3: Run directly from source

git clone https://github.com/shebnik/flutter_app_generator.git
cd flutter_app_generator

# Direct dart command (all platforms)
dart run bin/flutter_app_generator.dart -n MyApp

# Or use convenience scripts:
# Windows
flutter_app_generator.bat -n MyApp

# macOS/Linux (make executable first)
chmod +x flutter_app_generator.sh
./flutter_app_generator.sh -n MyApp

Usage

Basic Usage

# Using global installation
flutter_app_generator -n MyApp

# Or running from source
dart run bin/flutter_app_generator.dart -n MyApp

Advanced Usage

flutter_app_generator -n MyAwesomeApp -b com.example.myapp --verbose

Command Options

  • -n, --name (required): App name (supports proper casing, e.g., "MyAwesomeApp")
  • -b, --bundle-id: Bundle identifier (default: com.example)
  • -d, --description: App description
  • -p, --platforms: Target platforms (default: web,android,ios)
  • --firebase: Include Firebase dependencies (default: true)
  • --enhanced-main: Use enhanced main.dart with error handling (default: true)
  • --verbose: Show detailed output during generation

Generated App Structure

my_app/
โ”œโ”€โ”€ assets/                          # Empty assets folder
โ”œโ”€โ”€ lib/
โ”‚   โ”œโ”€โ”€ l10n/
โ”‚   โ”‚   โ”œโ”€โ”€ app_en.arb              # Localization files
โ”‚   โ”‚   โ””โ”€โ”€ l10n.dart               # Localization helper
โ”‚   โ”œโ”€โ”€ src/
โ”‚   โ”‚   โ””โ”€โ”€ app/
โ”‚   โ”‚       โ”œโ”€โ”€ app.dart            # Main app widget
โ”‚   โ”‚       โ”œโ”€โ”€ app_constants.dart  # App constants
โ”‚   โ”‚       โ”œโ”€โ”€ app_router.dart     # GoRouter configuration
โ”‚   โ”‚       โ””โ”€โ”€ app_theme.dart      # Theme configuration
โ”‚   โ””โ”€โ”€ main.dart                   # Enhanced main with error handling
โ”œโ”€โ”€ analysis_options.yaml           # Very Good Analysis rules
โ”œโ”€โ”€ l10n.yaml                       # Localization configuration
โ””โ”€โ”€ pubspec.yaml                    # Dependencies and configuration

Included Dependencies

Core Dependencies

  • flutter_svg - SVG support
  • go_router - Declarative routing
  • google_fonts - Google Fonts integration
  • package_info_plus - App information
  • path_provider - File system paths
  • intl - Internationalization
  • logger - Logging utilities
  • logger_service - Enhanced logging service
  • flutter_localizations - Localization support
  • flutter_web_plugins - Web plugin support
  • universal_io - Web platform support

Development Dependencies

  • very_good_analysis - Strict linting rules
  • build_runner - Code generation
  • freezed - Immutable classes
  • json_serializable - JSON serialization
  • flutter_launcher_icons - App icon generation

Firebase Dependencies (Optional)

  • firebase_core - Firebase core functionality
  • firebase_auth - Authentication
  • cloud_firestore - NoSQL database
  • cloud_functions - Cloud functions
  • firebase_crashlytics - Crash reporting
  • firebase_analytics - Analytics

Features Explained

Smart Naming

  • Input: MyAwesomeApp โ†’ Directory: myawesomeapp, Display Name: MyAwesomeApp
  • Automatically handles proper casing for display names while using lowercase for project structure

Platform-Specific Configuration

  • iOS: Updates Info.plist with correct display name
  • Android: Updates AndroidManifest.xml with app label
  • Web: Updates index.html title

Enhanced Main.dart

  • Global error handling with Firebase Crashlytics integration
  • Structured logging with file output
  • Platform-specific initialization
  • Firebase setup with emulator support for development

Clean Dependencies

  • Removes default flutter_lints in favor of very_good_analysis
  • Maintains alphabetical ordering in pubspec.yaml
  • Includes essential packages for modern Flutter development

Development

To contribute to this project:

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Test with various app configurations
  5. Submit a pull request

Requirements

  • Flutter SDK 3.0 or higher
  • Dart SDK 3.0 or higher

Platform Support

This tool works on all platforms that support Flutter:

  • Windows โœ…
  • macOS โœ…
  • Linux โœ…

Cross-Platform Notes

  • The tool automatically detects your platform and uses appropriate commands
  • All Flutter commands are executed with shell support for maximum compatibility
  • Path handling uses the path package for cross-platform file operations
  • No platform-specific dependencies or shell scripts required

Troubleshooting

Flutter Not Found

If you get "Flutter is not installed or not in PATH" error:

Permission Issues (macOS/Linux)

If you encounter permission issues:

# Make the script executable
chmod +x /path/to/flutter_app_generator

Global Activation Issues

If global activation fails:

# Check if pub cache is in PATH
dart pub global list

# Add pub cache to PATH if needed (example for bash/zsh)
echo 'export PATH="$PATH":"$HOME/.pub-cache/bin"' >> ~/.bashrc
source ~/.bashrc

License

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