Flutter is Google’s UI toolkit for building cross-platform apps. If you’re starting out, knowing the right terminal commands can save you more spare time. Here’s a curated list of the most important Flutter commands with examples.
Vital Flutter Commands
1. Check Flutter version
flutter –version
Example output:
Flutter 3.19.5 • Dart 3.3.1 • DevTools 2.30.0
⸻
2. Check setup & dependencies
flutter doctor
Example output:
Checks your environment: Xcode, Android Studio, devices, etc.
⸻
3. Create a new Flutter project
flutter create my_app
Example: Creates a new project in folder my_app.
⸻
4. Run your app
flutter run
Example: Runs the app on connected device or simulator.
⸻
5. Run on specific device
flutter run -d chrome
flutter run -d emulator-5554
Example: Runs on Chrome web or Android emulator.
⸻
6. Get dependencies
flutter pub get
Example: Installs all packages listed in pubspec.yaml.
⸻
7. Add a new package
flutter pub add http
Example: Adds http package automatically to pubspec.yaml.
⸻
8. Remove a package
flutter pub remove http
Example: Removes http package from your project.
⸻
9. Build APK for Android
flutter build apk –release
Example: Generates a release APK (app-release.apk).
⸻
10. Build App Bundle for Play Store
flutter build appbundle –release
Example: Generates .aab file for Google Play submission.
⸻
11. Build for iOS
flutter build ios –release
Example: Creates iOS build for App Store (requires macOS & Xcode).
⸻
12. Clean project cache
flutter clean
Example: Deletes build/ cache (fixes weird errors).
⸻
13. Analyze code
flutter analyze
Example: Reports errors, warnings, unused imports.
⸻
14. Format code
flutter format .
Example: Formats all Dart files in the project.
⸻
15. Upgrade Flutter
flutter upgrade
Example: Updates Flutter SDK to latest stable release.
⸻
12. Clean project cache
flutter clean
Example: Deletes build/ cache (fixes weird errors).
⸻
13. Analyze code
flutter analyze
Example: Reports errors, warnings, unused imports.
⸻
14. Format code
flutter format .
Example: Formats all Dart files in the project.
⸻
15. Upgrade Flutter
flutter upgrade
Example: Updates Flutter SDK to latest stable release.
With these commands, you can quickly set up, run, and publish Flutter apps directly from the terminal. Bookmark this page as your go-to Flutter reference for faster and smoother development.
