A command-line interface tool that creates Flutter projects with a predefined, scalable folder structure. This CLI tool helps you quickly scaffold a new Flutter project with an organized directory structure following best practices.
- Flutter SDK
- Dart SDK >=2.19.0 <4.0.0
-
Download Flutter SDK:
- Visit Flutter's official download page
- Choose your operating system and download the SDK
- Extract the downloaded file to a desired location
-
Add Flutter to PATH:
-
Windows:
- Add the full path to
flutter\binto your system's PATH variable - Open Command Prompt and run
flutter doctorto verify the installation
- Add the full path to
-
macOS/Linux:
- Add the following to your shell's config file (.bashrc, .zshrc, etc.):
export PATH="$PATH:[PATH_TO_FLUTTER_SDK]/flutter/bin"
- Replace [PATH_TO_FLUTTER_SDK] with your Flutter installation path
- Run
source ~/.bashrcorsource ~/.zshrcto apply changes - Verify installation with
flutter doctor
- Add the following to your shell's config file (.bashrc, .zshrc, etc.):
-
-
Run Flutter Doctor:
flutter doctor
- Follow any additional instructions to complete the setup
- Install any missing dependencies indicated by Flutter Doctor
-
Make sure you have Flutter installed on your system. If not, follow the official Flutter installation guide.
-
Install the CLI tool using one of these methods:
# Using dart pub global activate dart pub global activate flutter_cli # Or clone and install from source git clone https://github.com/iamEtornam/flutter_cli.git cd flutter_cli dart pub global activate --source path .
To compile the CLI tool into a native executable for Linux, macOS, and Windows, follow these steps:
1️⃣ Ensure Dart SDK is Installed
You need Dart installed. If you haven't installed it yet, get it from: 🔗 https://dart.dev/get-dart
Check your version:
dart --version2️⃣ Compile for the Current OS
If you only need an executable for the OS you're working on, use:
dart compile exe bin/flutter_cli.dartThis generates a flutter_cli.exe (Windows) or flutter_cli (Linux/macOS) in the same directory.
3️⃣ Compile for Specific Platforms
To compile for different operating systems, use cross-compilation:
🟢 Compile for Linux (on Linux)
dart compile exe bin/flutter_cli.dart -o flutter_cli_linux🟣 Compile for macOS (on macOS)
dart compile exe bin/flutter_cli.dart -o flutter_cli_macos🔵 Compile for Windows (on Windows)
dart compile exe bin/flutter_cli.dart -o flutter_cli_windows.exe4️⃣ Cross-Compiling
Dart does not support native cross-compilation (e.g., compiling a Windows executable on Linux). However, you can use Docker or a VM to compile for different platforms.
Cross-Compiling for Linux on macOS/Windows (Using Docker):
docker run --rm -v "$PWD":/app -w /app dart:latest dart compile exe bin/flutter_cli.dart -o flutter_cli_linuxFor macOS and Windows, you need a Mac and Windows PC (or a macOS runner like a Mac Mini in the cloud).
5️⃣ Verify the Output
Run:
./flutter_cli_linux # On Linux
./flutter_cli_macos # On macOS
flutter_cli_windows.exe # On Windows-
Open your terminal and run:
flutter_cli
-
Follow the prompts:
- Enter your project name
- Enter your bundle ID (e.g., com.example.app)
-
The CLI will create your project with the following structure:
project_name/
├── lib/
│ ├── components/ # Reusable UI components
│ ├── config/ # App configuration files
│ ├── extensions/ # Dart extensions
│ ├── features/ # Feature-specific code
│ ├── models/ # Data models
│ ├── resources/ # Resources and constants
│ ├── routes/ # Navigation/routing
│ ├── services/ # Services and APIs
│ ├── utils/ # Utility functions
│ └── views/ # UI screens/pages
└── assets/
├── images/ # Image assets
└── fonts/ # Font files
- components/: Reusable UI widgets and components
- config/: Application configuration, theme, and environment variables
- extensions/: Dart extension methods
- features/: Feature-specific code following a modular architecture
- models/: Data models and DTOs
- resources/: Static resources, strings, and constants
- routes/: Navigation routes and route management
- services/: API services, local storage, and other services
- utils/: Helper functions and utility classes
- views/: Main UI screens and pages
- Automatically creates
_index.dartfiles in each lib/ subdirectory for better code organization - Configures asset paths in pubspec.yaml
- Validates Flutter installation before project creation
Contributions are welcome! Please feel free to submit a Pull Request.
This project is licensed under the MIT License - see the LICENSE file for details.