To run a Flutter application, follow these steps:
-
Open Terminal or Command Prompt: Access your terminal or command prompt. On Windows, you can do this by searching for
cmd
in the Start menu. -
Navigate to Your Project Directory: Use the
cd
command to change directories to your Flutter project's root directory. For example:cd path/to/your/flutter_project
-
Ensure Devices are Connected: Make sure your target device (emulator or physical device) is connected and recognized by Flutter. You can check connected devices by running:
flutter devices
-
Run the Flutter Application: Execute the following command to run your Flutter application:
flutter run
This command compiles your app and installs it on the currently selected device.
-
Hot Reload: Once your app is running, you can make changes to your code and see them immediately reflected in the app through Hot Reload. Simply save your changes and press
r
in the terminal where your app is running. To perform a hot restart, which resets the state of the app, pressR
.
Remember, before running a Flutter application, ensure you have Flutter installed and properly set up on your system. You can verify your Flutter setup by running flutter doctor
in the terminal, which checks your environment and displays a report to the terminal window.