Package Management Commands
flutter pub get
- What it does: Downloads and installs all the packages/dependencies listed in your pubspec.yaml file
- Think of it like: Installing all the libraries your app needs to work (like npm install for Node.js)
flutter pub outdated
- What it does: Shows which packages have newer versions available
- Think of it like: Checking if any of your app’s libraries have updates
flutter pub upgrade
- What it does: Updates all packages to their latest compatible versions
- Think of it like: Actually updating those libraries to newer versions
Code Generation Commands
dart run build_runner build --delete-conflicting-outputs
- What it does: Generates code automatically (like JSON serialization, database models, etc.)
- Think of it like: Auto-generating boilerplate code you don’t want to write manually
- The flag:
--delete-conflicting-outputsremoves old generated files before creating new ones
Build Commands
flutter build apk --flavor dev --dart-define=FLAVOR=dev
- What it does: Creates an Android APK file (the installable app)
- –flavor: Builds a specific version (dev, prod, test) with different configurations
- –dart-define: Passes variables to your app (like telling it “you’re running in dev mode”)
flutter build ios --flavor dev
- What it does: Creates an iOS app bundle
- Same concept: Different version with specific settings
Testing & Analysis Commands
flutter test
- What it does: Runs all your automated tests
- Think of it like: Making sure your code works correctly before deploying
flutter analyze
- What it does: Checks your code for errors, warnings, and style issues
- Think of it like: A spell-checker for your code
Environment Commands
flutter --version
- What it does: Shows which Flutter version you’re using
- Why it’s useful: Ensures everyone uses the same version for consistent builds
Custom Commands
dart scripts/decrypt_files.dart $FILE_ENCRYPTION_PASSWORD
- What it does: Runs a custom script to decrypt encrypted configuration files
- Think of it like: Unlocking secret settings files with a password
dart run :validate_config
- What it does: Runs a custom validation script to check if your app configuration is correct
- Think of it like: Making sure all your settings are valid before building
Simple Summary
- Get dependencies → Download libraries your app needs
- Generate code → Auto-create repetitive code
- Analyze & test → Check code quality and functionality
- Build → Create the actual app file (APK/iOS)
- Deploy → Send the app to testing/distribution platforms