đ Basic Commands
FLX CLI āĻāϰ essential commands āĻā§āϞ⧠āĻļāĻŋāĻā§āύ āϝāĻž āĻĻāĻŋāϝāĻŧā§ āĻāĻĒāύāĻŋ 90% āĻāĻžāĻ āĻāϰāϤ⧠āĻĒāĻžāϰāĻŦā§āύ!
đ Command Structureâ
flx [command] [subcommand] [name] [options]
đ Essential Commandsâ
1. Help & Informationâ
# āϏāĻŦ commands āĻĻā§āĻā§āύ
flx --help
# Specific command āĻāϰ help
flx gen --help
flx config --help
# Version check āĻāϰā§āύ
flx --version
2. Configuration Commandsâ
# Current config āĻĻā§āĻā§āύ
flx config --list
# State management set āĻāϰā§āύ
flx config --state getx
flx config --state bloc
# Local project config (current directory)
flx config --state getx --local
# Global config reset āĻāϰā§āύ
flx config --reset
3. Generation Commandsâ
Feature Generation (Most Important! đ)â
# Complete feature āϤā§āϰāĻŋ āĻāϰā§āύ
flx gen feature auth
flx gen feature user_profile
flx gen feature product
# With additional options
flx gen feature auth --with-test
flx gen feature product --state-management=bloc
Individual Component Generationâ
# Model āϤā§āϰāĻŋ āĻāϰā§āύ
flx gen model user
flx gen model product --with-json
# Use case āϤā§āϰāĻŋ āĻāϰā§āύ
flx gen usecase login
flx gen usecase get_products
# Repository āϤā§āϰāĻŋ āĻāϰā§āύ
flx gen repository user
flx gen repository product --with-cache
# Screen/Page āϤā§āϰāĻŋ āĻāϰā§āύ
flx gen screen home
flx gen screen profile --with-form
đ¯ Quick Usage Examplesâ
Example 1: Auth Featureâ
# 1. Auth feature āϤā§āϰāĻŋ āĻāϰā§āύ
flx gen feature auth
# Generated structure:
# lib/features/auth/
# âââ data/
# â âââ models/auth_model.dart
# â âââ repositories/auth_repository_impl.dart
# â âââ datasources/auth_remote_data_source.dart
# âââ domain/
# â âââ entities/auth_entity.dart
# â âââ repositories/auth_repository.dart
# â âââ usecases/login_usecase.dart
# âââ presentation/
# âââ pages/auth_page.dart
# âââ controllers/auth_controller.dart
# âââ bindings/auth_binding.dart
Example 2: Product Managementâ
# 1. Product feature
flx gen feature product
# 2. Additional models
flx gen model category
flx gen model cart_item
# 3. Additional use cases
flx gen usecase add_to_cart
flx gen usecase remove_from_cart
# 4. Additional screens
flx gen screen product_details
flx gen screen cart
Example 3: User Profileâ
# 1. User feature with BLoC
flx config --state bloc
flx gen feature user_profile
# 2. Additional screens
flx gen screen edit_profile --with-form
flx gen screen settings
đ Command Optionsâ
Global Optionsâ
Option | Description | Example |
---|---|---|
--help | Show help | flx gen --help |
--version | Show version | flx --version |
--verbose | Detailed output | flx gen feature auth --verbose |
Generation Optionsâ
Option | Description | Default | Example |
---|---|---|---|
--state-management | State management type | getx | --state-management=bloc |
--with-test | Include test files | false | --with-test |
--with-json | Include JSON serialization | false | --with-json |
--with-form | Include form widgets | false | --with-form |
--with-cache | Include caching logic | false | --with-cache |
Config Optionsâ
Option | Description | Example |
---|---|---|
--local | Project-specific config | flx config --state getx --local |
--global | Global config (default) | flx config --state getx --global |
--reset | Reset configuration | flx config --reset |
--list | Show current config | flx config --list |
đ Workflow Commandsâ
Typical Development Flowâ
# 1. Project setup
flutter create my_app
cd my_app
# 2. Configure FLX CLI
flx config --state getx
# 3. Create core features
flx gen feature auth
flx gen feature home
flx gen feature profile
# 4. Add additional components
flx gen model settings
flx gen usecase logout
flx gen screen splash
# 5. Check what you've built
ls lib/features/
Quick Feature Additionâ
# āĻāĻāĻāĻŋ complete feature āĻŽāĻžāϤā§āϰ āĻāĻ āĻāĻŽāĻžāύā§āĻĄā§
flx gen feature notification --with-test
# Result: āϏāĻŦ Clean Architecture layers āϏāĻš complete feature!
đĄ Pro Tipsâ
1. Config Firstâ
# āĻĒā§āϰāĻĨāĻŽā§ config set āĻāϰā§āύ, āϤāĻžāϰāĻĒāϰ generate āĻāϰā§āύ
flx config --state getx
flx gen feature auth # GetX āĻĻāĻŋāϝāĻŧā§ āϤā§āϰāĻŋ āĻšāĻŦā§
2. Batch Generationâ
# Multiple features āĻāĻāϏāĻžāĻĨā§
flx gen feature auth
flx gen feature product
flx gen feature user
3. Check Generated Filesâ
# Generate āĻāϰāĻžāϰ āĻĒāϰ check āĻāϰā§āύ
tree lib/features/ # Unix/Linux/Mac
dir lib\features\ /s # Windows
4. Consistent Namingâ
# Snake case āĻŦā§āϝāĻŦāĻšāĻžāϰ āĻāϰā§āύ
flx gen feature user_profile # â
Good
flx gen feature UserProfile # â Avoid
đ Quick Troubleshootingâ
Common Commands for Issuesâ
# 1. Command not found
where flx # Windows
which flx # Unix/Linux/Mac
# 2. Permission issues
dart pub cache repair
# 3. Config problems
flx config --reset
flx config --state getx
# 4. Check installation
flx --version
dart pub global list
đ Next Stepsâ
āĻāĻ basic commands āĻĻāĻŋāϝāĻŧā§ āĻāĻĒāύāĻŋ:
- â Features āϤā§āϰāĻŋ āĻāϰāϤ⧠āĻĒāĻžāϰāĻŦā§āύ
- â Individual components generate āĻāϰāϤ⧠āĻĒāĻžāϰāĻŦā§āύ
- â Config manage āĻāϰāϤ⧠āĻĒāĻžāϰāĻŦā§āύ
- â Basic troubleshooting āĻāϰāϤ⧠āĻĒāĻžāϰāĻŦā§āύ
āĻāϰāĻĒāϰ: đ¯ Your First Feature āϤā§āϰāĻŋ āĻāϰā§āύ
Learning time: ~10 minutes âąī¸