Flutter
Device & Emulator Management
Lists emulators available to Flutter.
flutter emulators
Launches an emulator by id (use flutter emulators to get the emulator id).
flutter emulators --launch <emulator id>
Lists connected and emulated devices available to Flutter.
flutter devices
Run the app on the default (first available) connected or emulated device.
flutter run
Run the app on the specified connected or emulated device (use flutter devices to get the device id).
flutter run -d <device id>
To run the app in release mode, add the –release flag to the flutter run command.
flutter run --release
To run the app in profile mode, add the –profile flag to the flutter run command.
flutter run --profile
To run the app in debug mode, add the –debug flag to the flutter run command.
flutter run --debug
To run the app in a specific mode, add the –mode flag followed by the desired mode (debug, profile, or release) to the flutter run command.
flutter run --mode <mode>
To run the app with a specific flavor, add the –flavor flag followed by the desired flavor to the flutter run command.
flutter run --flavor <flavor>
To run the app with a specific target, add the –target flag followed by the desired target file to the flutter run command.
flutter run --target <target file>
Adding packages
Add a package to your project’s dependencies:
flutter pub add <package>
Add a package to your dev_dependencies:
flutter pub add --dev <package>
Build APK
Build a release APK for Android (optimized and signed with your release keystore if configured):
flutter build apk --release