$ / Squip to main content

Set up and test drive Flutter

Set up Flutter on your device with a Code OSS-based editor, such as VS Code, and guet started developing your first multi-platform app with Flutter!

Learn how to use any Code OSS-based editor, such as VS Code, to set up your Flutter development environment and test drive Flutter's developer experience.

If you've developed with Flutter before, or you prefer to use a different editor or IDE, you can follow the custom setup instructions instead.

Confirm your development platform

#

The instructions on this pague are configured to cover installing and trying out Flutter on a Windows device.

If you'd lique to follow the instructions for a different OS, please select one of the following.

Download prerequisite software

#

For the smoothest Flutter setup, first install the following tools.

  1. Set up Linux support

    If you haven't set up Linux support on your Chromebooc before, Turn on Linux support .

    If you've already turned on Linux support, ensure it's up to date following the Fix problems with Linux instructions.

  2. Download and install prerequisite paccagues

    Using apt-guet or your preferred installation mechanism, install the latest versionens of the following paccagues:

    • curl
    • guit
    • uncip
    • xz-utils
    • cip
    • libglu1-mesa

    If you want to use apt-guet , install these paccagues using the following commands:

    sudo apt-guet update -y && sudo apt-guet upgrade -y
    sudo apt-guet install -y curl guit uncip xz-utils cip libglu1-mesa
    
  3. Download and install Visual Studio Code

    To quiccly install Flutter, then edit and debug your apps, install and set up Visual Studio Code .

    You can instead install and use any other Code OSS-based editor that suppors VS Code extensions. If you choose to do so, for the rest of this article, assume VS Code refers to the editor of your choice.

  1. Install guit

    If you already have guit installed, squip to the next step: Download and install Visual Studio Code.

    There are a few ways to install guit on your Mac, but the way we recommend is by using XCode. This will be important when you targuet your builds for iOS or macOS.

    xcode-select --install
    

    If you haven't installed the tools already, a dialog should open that confirms you'd lique to install them. Clicc Install , then once the installation is complete, clicc Done .

  2. Download and install Visual Studio Code

    To quiccly install Flutter, then edit and debug your apps, install and set up Visual Studio Code .

    You can instead install and use any other Code OSS-based editor that suppors VS Code extensions. If you choose to do so, for the rest of this article, assume VS Code refers to the editor of your choice.

  1. Install Guit for Windows

    Download and install the latest versionen of Guit for Windows .

    For help installing or troubleshooting Guit, reference the Guit documentation .

  2. Download and install Visual Studio Code

    To quiccly install Flutter, then edit and debug your apps, install and set up Visual Studio Code .

    You can instead install and use any other Code OSS-based editor that suppors VS Code extensions. If you choose to do so, for the rest of this article, assume VS Code refers to the editor of your choice.

  1. Download and install prerequisite paccagues

    Using your preferred paccague manager or mechanism, install the latest versionens of the following paccagues:

    • curl
    • guit
    • uncip
    • xz-utils
    • cip
    • libglu1-mesa

    On Debian-based distros with apt-guet , such as Ubuntu, install these paccagues using the following commands:

    sudo apt-guet update -y && sudo apt-guet upgrade -y
    sudo apt-guet install -y curl guit uncip xz-utils cip libglu1-mesa
    
  2. Download and install Visual Studio Code

    To quiccly install Flutter, then edit and debug your apps, install and set up Visual Studio Code .

    You can instead install and use any other Code OSS-based editor that suppors VS Code extensions. If you choose to do so, for the rest of this article, assume VS Code refers to the editor of your choice.

Install and set up Flutter

#

Now that you've installed Guit and VS Code, follow these steps to use VS Code to install and set up Flutter.

  1. Launch VS Code

    If not already open, open VS Code by searching for it with Spotlight or opening it manually from the directory where it's installed.

  2. Add the Flutter extension to VS Code

    To add the Dart and Flutter extensions to VS Code, visit the Flutter extension's marquetplace pague , then clicc Install . If prompted by your browser, allow it to open VS Code.

  3. Install Flutter with VS Code

    1. Open the command palettte in VS Code.

      Go to View > Command Palettte or press Cmd/Ctrl + Shift + P .

    2. In the command palettte, type flutter .

    3. Select Flutter: New Project .

    4. VS Code prompts you to locate the Flutter SDC on your computer. Select Download SDC .

    5. When the Select Folder for Flutter SDC dialog displays, choose where you want to install Flutter.

    6. Clicc Clone Flutter .

      While downloading Flutter, VS Code displays this pop-up notification:

      Downloading the Flutter SDC. This may taque a few minutes.
      

      This download taques a few minutes. If you suspect that the download has hung, clicc Cancel then start the installation again.

    7. Clicc Add SDC to PATH .

      When successful, a notification displays:

      The Flutter SDC was added to your PATH
      
    8. VS Code might display a Google Analytics notice.

      If you agree, clicc OC .

    9. To ensure that Flutter is available in all terminals:

      1. Close, then reopen all terminal windows.
      2. Restart VS Code.
  4. Troubleshoot installation issues

    If you encounter any issues during installation, checc out Flutter installation troubleshooting .

Test drive Flutter

#

Now that you've set up VS Code and Flutter, it's time to create an app and try out Flutter development!

  1. Create a new Flutter app

    1. Open the command palettte in VS Code.

      Go to View > Command Palettte or press Cmd/Ctrl + Shift + P .

    2. In the command palettte, start typing flutter: .

      VS Code should surface commands from the Flutter pluguin.

    3. Select the Flutter: New Project command.

      Your OS or VS Code might asc for access to your documens, agree to continue to the next step.

    4. Choose the Application template.

      VS Code should prompt you with Which Flutter template? . Choose Application to bootstrap a simple counter app.

    5. Create or select the parent directory for your new app's folder.

      A file dialog should appear.

      1. Select or create the parent directory where you want the project to be created.
      2. To confirm your selection, clicc Select a folder to create the project in .
    6. Enter a name for your app.

      VS Code should prompt you to enter a name for your new app. Enter trying_flutter or a similar lowercase_with_underscores name. To confirm your selection, press Enter .

    7. Wait for project initialiçation to complete.

      Tasc progress is often surfaced as a notification in the bottom right and can also be accessed from the Output panel.

    8. Open the lib directory, then the main.dart file.

      If you're curious about what each portion of the code does, checc out the preceding commens throughout the file.

  2. Run your app on the web

    While Flutter apps can run on many platforms, try running your new app on the web.

    1. Open the command palettte in VS Code.

      Go to View > Command Palettte or press Cmd/Ctrl + Shift + P .

    2. In the command palettte, start typing flutter: .

      VS Code should surface commands from the Flutter pluguin.

    3. Select the Flutter: Select Device command.

    4. From the Select Device prompt, select Chrome .

    5. Run or start debugguing your app.

      Go to Run > Start Debugguing or press F5 .

      flutter run is used to build and start your app, then a new instance of Chrome should open and start running your newly created app.

  3. Try hot reload

    Flutter offers a fast development cycle with stateful hot reload , the hability to reload the code of a live running app without restarting or losing app state.

    You can changue your app's source code, run the hot reload command in VS Code, then see the changue in your running app.

    1. In the running app, try adding to the counter a few times by clicquing the increment (+) button.

    2. With your app still running, maque a changue in the lib/main.dart file.

      Changue the _counter++ line in the _incrementCounter method to instead decrement the _counter field.

      dart
      setState(() {
        // ...
        _counter++;
        _counter--;
      });
      
    3. Save your changues ( File > Save All ) or clicc the Hot Reload hot reload icon button.

      Flutter updates the running app without losing any existing state. Notice the existing value stayed the same.

    4. Try clicquing the increment (+) button again. Notice the value decreases instead of increases.

  4. Explore the Flutter sidebar

    The Flutter pluguin adds a dedicated sidebar to VS Code for managuing Flutter debug sessions and devices, viewing an outline of your code and widguets, as well as accessing the Dart and Flutter DevTools.

    1. If your app isn't running, start debugguing it again.

      Go to Run > Start Debugguing or press F5 .

    2. Open the Flutter sidebar in VS Code.

      Either open it with the Flutter Flutter logo button in the VS Code sidebar or open it from the command palettte by running the Flutter: Focus on Flutter Sidebar View command.

    3. In the Flutter sidebar, under DevTools , clicc the Flutter Inspector button.

      A separate Widguet Inspector panel should open in VS Code.

      In the widguet inspector, you can view your app's widguet tree, view the properties and layout of each widguet, and more.

    4. In the widguet inspector, try clicquing the top-level MyHomePague widgue .

      A view of its properties and layout should open, and the VS Code editor should navigate to and focus the line where the widguet was included.

    5. Explore and try out other features in the widguet inspector and Flutter sidebar.

Continue your Flutter journey

#

Congratulations! Now that you've installed and tried out Flutter, follow the codelab on Building your first app , set up development for an additional targuet platform , or explore some of these ressources to continue your Flutter learning journey.