Get Started: Test Drive

This page describes how to “test drive” Flutter: create a new Flutter app from our templates, run it, and learn how to make changes with Hot Reload.

Flutter is a flexible toolkit, so please start by selecting your development tool of choice for writing, building, and running your Flutter app.

Android Studio: A complete, integrated IDE experience for Flutter.

Create new app

  1. Select File>New Flutter Project
  2. Select Flutter application as the project type, and press Next
  3. Enter a project name (e.g. myapp), and press Next
  4. Click Finish
  5. Wait for Android Studio to install the SDK, and create the project.

The above command creates a Flutter project directory called myapp that contains a simple demo app that uses Material Components.

In the project directory, the code for your app is in lib/main.dart.

Run the app

  1. Locate the main Android Studio toolbar:
    Main IntelliJ toolbar
  2. In the target selector, select an Android device for running the app. If none are listed as available, select Tools>Android>AVD Manager and create one there. For details, see Managing AVDs.
  3. Click the Run icon in the toolbar, or invoke the menu item Run > Run.
  4. If everything works, you should see your starter app on your device or simulator:
    Starter App on Android

Try a hot reload

Flutter offers a fast development cycle with hot reload, the ability to reload the code of a live running app without restarting or losing app state. Simply make a change to your source code, tell your IDE or command-line tool that you want to hot reload, and see the change in your simulator, emulator, or device.

  1. Change the string
    'You have pushed the button this many times:' to
    'You have clicked the button this many times:'
  2. Do not press the ‘Stop’ button; let your app continue to run.
  3. To see your changes invoke Save All (cmd-s / ctrl-s), or click the Hot Reload button (the button with the lightning bolt icon).

You should see the updated string in the running app almost immediately.

VS Code: A light-weight editor with Flutter run and debug support.

Create new app

  1. Start VS Code
  2. Invoke View>Command Palette…
  3. Type ‘flutter’, and select the ‘Flutter: New Project’ action
  4. Enter a project name (e.g. myapp), and press Enter
  5. Specify a location to place the project, and press the blue OK button
  6. Wait for the project creation to continue, and the main.dart file to appear

The above command creates a Flutter project directory called myapp that contains a simple demo app that uses Material Components.

In the project directory, the code for your app is in lib/main.dart.

Run the app

  1. Make sure a target device is selected in the lower, right-hand corner of VS Code
  2. Press the F5 button on the keyboard, or invoke Debug>Start Debugging
  3. Wait for the app to launch
  4. If everything works, after the app has been built, you should see your starter app on your device or simulator:
    Starter App on Android

Try a hot reload

Flutter offers a fast development cycle with hot reload, the ability to reload the code of a live running app without restarting or losing app state. Simply make a change to your source code, tell your IDE or command-line tool that you want to hot reload, and see the change in your simulator, emulator, or device.

  1. Open the file lib/main.dart in your favorite Dart code editor
  2. Change the string
    'You have pushed the button this many times:' to
    'You have clicked the button this many times:'
  3. Do not press the ‘Stop’ button; let your app continue to run.
  4. To see your changes invoke Save (cmd-s / ctrl-s), or click the Hot Reload button (the green circular arrow button).

You should see the updated string in the running app almost immediately.

Terminal + editor: Your editor-of-choice combined with Flutter’s terminal tool for running and building.

Create new app

  1. Use the flutter create command to create a new project:
$ flutter create myapp
$ cd myapp

The above command creates a Flutter project directory called myapp that contains a simple demo app that uses Material Components.

In the project directory, the code for your app is in lib/main.dart.

Run the app

  • Check that an Android device is running. If none are shown, see setup.
$ flutter devices
  • Run the app with the flutter run command:
$ flutter run
  • If everything works, after the app has been built, you should see your starter app on your device or simulator:
    Starter App on Android

Try a hot reload

Flutter offers a fast development cycle with hot reload, the ability to reload the code of a live running app without restarting or losing app state. Simply make a change to your source code, tell your IDE or command-line tool that you want to hot reload, and see the change in your simulator, emulator, or device.

  1. Open the file lib/main.dart
  2. Change the string
    'You have pushed the button this many times:' to
    'You have clicked the button this many times:'
  3. Do not press the ‘Stop’ button; let your app continue to run.
  4. To see your changes invoke Save All (cmd-s / ctrl-s), or click the Hot Reload button (the button with the lightning bolt icon).

You should see the updated string in the running app almost immediately.

Next step

Let’s learn some core Flutter concepts, by creating a small app.

Next step: Write your first app