Flutter Tutorial:
Flutter Widgets:
Flutter Advance
Flutter REST API
Advanced Concepts
Wrap vs Builder vs OverBarFlow
Circular progress conatin Icon
Flutter State management Comparison
Flutter Database
Flutter Token Expired Handling
Flutter Provider
Flutter GetX
Flutter with Native
Flutter Tips:
Interview Questions
Flutter 100 Interview Questions
Commands that every Flutter developer should know
Flutter framework for building cross-platform mobile applications, offers several helpful shortcut commands to enhance development productivity.
Popular Commands in Flutter
Note: In order to use these commands in your Flutter project, it is necessary to setup Flutter SDK properly.
- flutter run – Runs the Flutter application on an attached device or emulator.
- flutter create – Creates a new Flutter project.
- flutter doctor – Checks the status of your Flutter installation and provides guidance on any missing dependencies or configuration issues.
- flutter pub get – Fetches and updates the dependencies listed in the pubspec.yaml file.
- flutter build – Builds the Flutter project for the specified target platform (e.g., flutter build apk, flutter build ios).
- flutter clean – Deletes the build artifacts, such as the build directory, and ensures a clean build.
- flutter upgrade – Upgrades the Flutter SDK to the latest version.
- flutter analyze – Analyzes the Dart code for potential issues and provides feedback.
- flutter test – Runs unit tests present in the project.
- flutter format – Automatically formats the Dart code based on the Flutter style guidelines.
- flutter devices – Lists all the connected devices/emulators available for running the Flutter application.
- flutter logs – Displays the logs of the running Flutter application.
- flutter packages get – Fetches and updates the dependencies listed in the pubspec.yaml file.
- flutter packages upgrade – Upgrades the dependencies in the pubspec.yaml file to their latest versions.
- flutter create NAME OF THE PROJECT – Creates a Flutter project in the current directory, useful for initializing Flutter within an existing project. example flutter create testapp
These commands are widely used in Flutter development to streamline the workflow and boost productivity.
Platform-specific run commands | Window | Mac | Linux | Mobile | Web
Flutter provides several platform-specific run commands to execute your Flutter application on different target platforms. Here are the various platform run commands in Flutter:
flutter run: Runs the Flutter application on the default platform (usually the connected device or emulator).
flutter run -d <device>: Runs the Flutter application on a specific device or emulator. Replace <device> with the device ID or name. You can get the list of available devices by running flutter devices.
flutter run -t lib/main.dart: Runs the Flutter application, explicitly specifying the entry point file as lib/main.dart. You can replace it with the desired file path.
flutter run -flavor <flavor>: Runs the Flutter application with a specific flavor. Flavors allow you to create different versions of your app for various environments (e.g., development, staging, production). Replace <flavor> with the name of the desired flavor.
flutter run -d web: Runs the Flutter application in a web browser. This command is used when building for the web platform.
flutter run -d android: Runs the Flutter application on an Android device or emulator.
flutter run -d ios: Runs the Flutter application on an iOS device or simulator.
flutter run -d macos: Runs the Flutter application on macOS.
flutter run -d windows: Runs the Flutter application on Windows.
flutter run -d linux: Runs the Flutter application on Linux.
flutter run -d <custom_device_id>: Runs the Flutter application on <custom_device_id like Nexus/Pixel>. This is useful for running on specific hardware or custom emulators.
Commands that helps in existing project:
flutter config --enable-android --enable-ios [Enable Android and ios support]
flutter config --no-enable-web [Disable web support ]
flutter create --platforms=android . [There is a period (full stop) which will create android in the project]
flutter config --enable-windows-desktop [enable window-desktop support]
flutter create --platforms=web,macos . [To add web and macOS platform run this command line]
flutter create --platforms=linux . [To add Linux platform run this command line]
flutter clean [ some time issue in pub get or package not upload or gradle changes not reflect or build clean]
flutter clean cache [ To clean cache ]