flutter_enterprise_cli

Enterprise-grade Flutter CLI tool for generating production-ready project scaffolding with clean architecture, multi-environment flavors, and CI/CD automation.


✨ Features

  • 🏗 Clean Architecture folder structure
  • 🔀 Android flavor automation (dev / prod)
  • 🍎 iOS entrypoint configuration support
  • 🚀 GitHub Actions CI/CD template (Enterprise-ready)
  • 📦 Dev APK + Prod AAB builds
  • 📱 Dev & Prod IPA generation (Signed or Unsigned)
  • 🔐 Optional Android & iOS code signing support
  • 🛑 Prevents nested project creation
  • 🛡 Safe project overwrite protection
  • ⚙ CLI-based architecture generation
  • 🌍 Cross-platform support (Windows / macOS / Linux)

🚀 Installation

Activate globally:

dart pub global activate flutter_enterprise_cli

⚙ If Command Not Found

After activation, if you see:

flutter_enterprise_cli: command not found

You need to add Dart Pub Cache to your system PATH.

🪟 Windows

Add this to Environment Variables:

%LOCALAPPDATA%\Pub\Cache\bin

Then restart your terminal.

🍎 macOS / 🐧 Linux

Add this line to your ~/.zshrc or ~/.bashrc:

export PATH="$PATH:$HOME/.pub-cache/bin"

Then run:

source ~/.zshrc

🛠 Usage

Create a new enterprise project

flutter_enterprise_cli create my_app

📂 Generated Project Structure

lib/
 ├── core/
 ├── data/
 ├── domain/
 ├── presentation/
 ├── routes/
 ├── app/
 │    ├── app.dart
 │    └── bootstrap.dart
 ├── main_dev.dart
 └── main_prod.dart

Create project with specific state management

flutter_enterprise_cli create my_app --state riverpod --flavors dev,prod

Add CI/CD to Existing Project

Run inside your Flutter project:

flutter_enterprise_cli ci

Generate a ready-to-use Bloc page module

Run inside your Flutter project:

flutter_enterprise_cli page <page_name>

Generated structure:

presentation/pages/login
├── login_page.dart
├── model
│    └── login_model.dart
└── bloc
├── login_bloc.dart
├── login_event.dart
└── login_state.dart

Generate Page with Model

flutter_enterprise_cli page <page_name> json

Api Testing via CLI

flutter_enterprise_cli api test

API Test Features

This allows:
Testing API endpoints
Viewing formatted responses
Generating Dart models from API JSON

Example API Test Flow

flutter_enterprise_cli api test
Enter API URL:
https://dev-api.example.com/Account/login
HTTP Method (GET/POST/PUT/DELETE):
POST

📦 Headers loaded from user project:
Content-Type : application/json
UtcOffsetInSecond : 19800
AppVersion : 1
DeviceTypeId : 1
LanguageCode : en

Enter extra headers JSON (optional, press ENTER twice to skip):


Enter Request JSON (press ENTER twice to finish):
{
"email":"test@yopmail.com",
"password":"Test@123",
"deviceToken":"",
"deviceType":1,
"userType":1,
"rememberMe":false
}


📡 Calling API...

✅ Server Message:
Success

📦 Full Response:
{
"data": {
"userId": 1518,
"firstName": "ravi",
"lastName": "singh",
"email": "ravi@yopmail.com",
"profileImage": null,
"authorizationToken": "",
"accessToken": "",
"userType": 2
},
"message": "Success",
"apiName": "Login"
}

Generate module from this response? (y/n)
y
Enter module name:
login

Generated model:

class LoginModel {
    final LoginData? data;
    final String? message;
    final String? apiName;

LoginModel({
    this.data,
    this.message,
    this.apiName,
});

factory LoginModel.fromJson(Map<String, dynamic> json) {
return LoginModel(
    data: json['data'] != null ? LoginData.fromJson(json['data']) : null,
    message: json['message'],
    apiName: json['apiName'],
);
}

Map<String, dynamic> toJson() {
return {
    'data': data?.toJson(),
    'message': message,
    'apiName': apiName,
 };
}

LoginModel copyWith({
    LoginData? data,
    String? message,
    String? apiName,
}) {
return LoginModel(
    data: data ?? this.data,
    message: message ?? this.message,
    apiName: apiName ?? this.apiName,
    );
 }
}

class LoginData {
    final int? userId;
    final String? firstName;
    final String? lastName;
    final String? email;
    final dynamic profileImage;
    final String? authorizationToken;
    final String? accessToken;
    final int? userType;

LoginData({
    this.userId,
    this.firstName,
    this.lastName,
    this.email,
    this.profileImage,
    this.authorizationToken,
    this.accessToken,
    this.userType,
});

factory LoginData.fromJson(Map<String, dynamic> json) {
return LoginData(
    userId: json['userId'],
    firstName: json['firstName'],
    lastName: json['lastName'],
    email: json['email'],
    profileImage: json['profileImage'],
    authorizationToken: json['authorizationToken'],
    accessToken: json['accessToken'],
    userType: json['userType'],
 );
}

Map<String, dynamic> toJson() {
    return {
        'userId': userId,
        'firstName': firstName,
        'lastName': lastName,
        'email': email,
        'profileImage': profileImage,
        'authorizationToken': authorizationToken,
        'accessToken': accessToken,
        'userType': userType,
    };
}

LoginData copyWith({
    int? userId,
    String? firstName,
    String? lastName,
    String? email,
    dynamic profileImage,
    String? authorizationToken,
    String? accessToken,
    int? userType,
}) {
return LoginData(
    userId: userId ?? this.userId,
    firstName: firstName ?? this.firstName,
    lastName: lastName ?? this.lastName,
    email: email ?? this.email,
    profileImage: profileImage ?? this.profileImage,
    authorizationToken:
    authorizationToken ?? this.authorizationToken,
    accessToken: accessToken ?? this.accessToken,
    userType: userType ?? this.userType,
  );
 }
}

Add Re-usable UI Module

Run inside your Flutter project:

flutter_enterprise_cli ui
Lists all available templates and their descriptions.

Add new module

flutter_enterprise_cli ui <template_id> <page_name>
Example: flutter_enterprise ui login login
New: Now automatically installs the Network Layer if you choose "y" for API calling.

Add validation

flutter_enterprise add validation
Adds BLoC-integrated form validation to any page. Auto-detects fields like email/password and injects formKey into the BLoC.

Create route page and auto install go_router

flutter_enterprise_cli create route
Initializes GoRouter and configures your app.dart.

Add new route

flutter_enterprise_cli add route <page_name>

Generate Ready to use Networking Module for api calling

Run inside your Flutter project:

flutter_enterprise_cli add network

Example usage:

final response = await ApiService.client.post(
ApiEndpoints.login,
    data: {
    "email": "test@email.com",
    "password": "123456"
    },
);
if (response.success) {
  print(response.data);
} else {
  print(response.message);
}

Generated structure:

lib/core/network
├── api_client.dart
├── api_interceptor.dart
├── api_exception.dart
├── api_response.dart
├── api_endpoints.dart
└── network_info.dart

lib/core/config
└── app_config.dart

lib/core/services
└── api_service.dart

Configure Flavors in Existing Project

Run inside your Flutter project:

flutter_enterprise_cli flavors

🧠 Available State Management Options

  • bloc (default)
  • riverpod

📂 Generated Project Structure

lib/
 ├── core/
 ├── data/
 ├── domain/
 ├── presentation/
 ├── routes/
 ├── app/
 │    ├── app.dart
 │    └── bootstrap.dart
 ├── main_dev.dart
 └── main_prod.dart

Add Cursor and GitHub Copilot rules

flutter_enterprise_cli add rules

What it does:

Cursor Support: Generates custom .cursorrules in .cursor/rules/ to guide Cursor's AI on your project structure and coding standards.
GitHub Copilot Skills: Injects .github/skills to provide context-aware suggestions within GitHub Repositories.
Architecture Context: Informs the AI about your Clean Architecture setup, BLoC/Riverpod usage, and folder structure.
Usage:
Run the command in your project root.
Select your target IDE/Tool:
1 for Cursor
2 for GitHub Copilot
The CLI will automatically populate the necessary directories with specialized rules.

🔀 Android Flavors

Run example:

flutter run --flavor dev -t lib/main_dev.dart

🍎 iOS Support

  • Generates dev.xcconfig and prod.xcconfig
  • Supports IPA generation in CI
  • Uses unsigned IPA by default (--no-codesign)
  • Automatically signs if secrets are configured

🔐 Optional Code Signing (CI Configuration)

The generated CI workflow supports optional signing.

If secrets are not configured:

  • Android builds will be unsigned
  • iOS builds will use --no-codesign
  • CI will NOT fail

🤖 Android Signing (Play Store Release)

Add the following GitHub Repository Secrets:

ANDROID_KEYSTORE_BASE64
ANDROID_KEYSTORE_PASSWORD
ANDROID_KEY_ALIAS
ANDROID_KEY_PASSWORD

Convert Keystore to Base64

base64 release.keystore > keystore.txt

Copy the output into ANDROID_KEYSTORE_BASE64.


🍎 iOS Signing (App Store / TestFlight)

Add the following GitHub Repository Secrets:

APPLE_CERTIFICATE_BASE64
APPLE_CERTIFICATE_PASSWORD
APPLE_PROVISION_PROFILE_BASE64

Convert Certificate to Base64

base64 certificate.p12 > cert.txt

Convert Provisioning Profile to Base64

base64 profile.mobileprovision > profile.txt

🚀 CI/CD Included

Generated project includes:

  • Android Dev APK
  • Android Prod AAB
  • iOS Dev IPA
  • iOS Prod IPA
  • Artifact uploads
  • Flutter analyze step
  • Gradle & Pub caching
  • Java 17 setup

Workflow file:

.github/workflows/flutter_ci.yml


⚙ Requirements

  • Flutter 3.35.5+
  • Dart SDK 3.5+
  • macOS required for iOS builds
  • GitHub Actions for CI/CD

📄 License

MIT License

Libraries

commands/api_test_command
CLI command for testing APIs directly from terminal.
constant/app_assets
constant/app_strings
constant/storage_keys
generators/architecture_generator
Generates enterprise Flutter architecture structure.
generators/ci_generator
generators/figma_generator
generators/flavor_generator
generators/json_model_generator
generators/module_generator
generators/network_generator
generators/page_generator
generators/router_generator
generators/rules_generator
modules/network_module
modules/rules_module
modules/templates/api/api_client_template
modules/templates/api/api_config_template
modules/templates/api/api_endpoints_template
modules/templates/api/api_exception_template
modules/templates/api/api_interceptor_template
modules/templates/api/api_response_template
modules/templates/api/api_service_template
modules/templates/api/network_info_template
modules/templates/auth/forgot_password_template
modules/templates/auth/login_template
modules/templates/auth/otp_template
modules/templates/auth/profile_setup_template
modules/templates/auth/signup_template
modules/templates/common/blank_template
modules/templates/common/faq_template
modules/templates/common/form_template
modules/templates/common/grid_template
modules/templates/common/introduction_template
modules/templates/common/list_template
modules/templates/common/tab_template
modules/templates/dashboard/dashboard_template
modules/templates/ecommerce/address_book_template
modules/templates/ecommerce/checkout_template
modules/templates/ecommerce/ecommerce_home_template
modules/templates/ecommerce/my_orders_template
modules/templates/ecommerce/order_success_template
modules/templates/ecommerce/order_tracking_template
modules/templates/ecommerce/payment_methods_template
modules/templates/ecommerce/product_details_template
modules/templates/ecommerce/shopping_cart_template
modules/templates/ecommerce/wishlist_template
modules/templates/social/all_chat_template
modules/templates/social/chat_template
modules/templates/social/friend_templates
modules/templates/template_registry
modules/widgets/common_asset_widget_template
modules/widgets/common_cached_image_template
modules/widgets/common_date_picker_template
modules/widgets/common_dialog_template
modules/widgets/common_empty_detail_page_template
modules/widgets/common_expand_collaspe_template
modules/widgets/common_image_picker_template
modules/widgets/common_pull_to_refresh_template
modules/widgets/common_read_more_text_template
modules/widgets/common_svg_widget_template
modules/widgets/custom_appbar_template
modules/widgets/custom_body_template
modules/widgets/custom_bottom_bar_template
modules/widgets/custom_dropdown_template
modules/widgets/custom_list_widget_template
modules/widgets/custom_phonefield_template
modules/widgets/custom_side_drawer_template
modules/widgets/dismiss_keyboard_template
modules/widgets/friend_card_template
modules/widgets/gender_radio_group_template
modules/widgets/html_read_more_text_template
modules/widgets/no_internet_widget_template
modules/widgets/onboarding_card_template
modules/widgets/shimmer_page_template
modules/widgets/shimmer_wrapper_template
modules/widgets/swipe_action_button_template
modules/widgets/text_input_widget_template
modules/widgets/text_widget_template
modules/widgets/widgets_map
modules/widgets_module
services/api_tester
services/figma_service
theme/app_colors
utils/app_logs
utils/app_validators
utils/azure_upload
utils/common_snackbar
utils/file_utils
utils/gender_enum
utils/global_snackbar
utils/keyboard_utils
utils/responsive_size
utils/string_utils
utils/top_diagonal_clipper