| title | Set up and test drive Flutter |
|---|---|
| shortTitle | Quick start |
| description | Set up Flutter on your device with a Code OSS-based editor, such as VS Code, and get started developing your first multi-platform app with Flutter! |
| showBanner | false |
| sitemap | false |
{% render "docs/install/quick.md" site: site %}
Now that you've set up VS Code and Flutter, it's time to create an app and try out Flutter development!
-
-
Open the command palette in VS Code.
Go to View > Command Palette or press Cmd/Ctrl + Shift + P.
-
In the command palette, start typing
flutter:.VS Code should surface commands from the Flutter plugin.
-
Select the Flutter: New Project command.
Your OS or VS Code might ask for access to your documents, agree to continue to the next step.
-
Choose the Application template.
VS Code should prompt you with Which Flutter template?. Choose Application to bootstrap a simple counter app.
-
Create or select the parent directory for your new app's folder.
A file dialog should appear.
- Select or create the parent directory where you want the project to be created.
- To confirm your selection, click Select a folder to create the project in.
-
Enter a name for your app.
VS Code should prompt you to enter a name for your new app. Enter
trying_flutteror a similarlowercase_with_underscoresname. To confirm your selection, press Enter. -
Wait for project initialization to complete.
Task progress is often surfaced as a notification in the bottom right and can also be accessed from the Output panel.
-
Open the
libdirectory, then themain.dartfile.If you're curious about what each portion of the code does, check out the preceding comments throughout the file.
-
-
While Flutter apps can run on many platforms, try running your new app on the web.
-
Open the command palette in VS Code.
Go to View > Command Palette or press Cmd/Ctrl + Shift + P.
-
In the command palette, start typing
flutter:.VS Code should surface commands from the Flutter plugin.
-
Select the Flutter: Select Device command.
-
From the Select Device prompt, select Chrome.
-
Run or start debugging your app.
Go to Run > Start Debugging or press F5.
flutter runis used to build and start your app, then a new instance of Chrome should open and start running your newly created app.
-
-
Flutter offers a fast development cycle with stateful hot reload, the ability to reload the code of a live running app without restarting or losing app state.
You can change your app's source code, run the hot reload command in VS Code, then see the change in your running app.
-
In the running app, try adding to the counter a few times by clicking the
{: .text-icon} button. -
With your app still running, make a change in the
lib/main.dartfile.Change the
_counter++line in the_incrementCountermethod to instead decrement the_counterfield.setState(() { // ... - _counter++; + _counter--; });
-
Save your changes (File > Save All) or click the Hot Reload
{: .text-icon} button.
Flutter updates the running app without losing any existing state. Notice the existing value stayed the same.
-
Try clicking the
{: .text-icon} button again.
Notice the value decreases instead of increases.
-
-
The Flutter plugin adds a dedicated sidebar to VS Code for managing Flutter debug sessions and devices, viewing an outline of your code and widgets, as well as accessing the Dart and Flutter DevTools.
-
If your app isn't running, start debugging it again.
Go to Run > Start Debugging or press F5.
-
Open the Flutter sidebar in VS Code.
Either open it with the Flutter
{: .text-icon} button in the VS Code sidebar or open it from the command palette by running the Flutter: Focus on Flutter Sidebar View command.
-
In the Flutter sidebar, under DevTools, click the Flutter Inspector button.
A separate Widget Inspector panel should open in VS Code.
In the widget inspector, you can view your app's widget tree, view the properties and layout of each widget, and more.
-
In the widget inspector, try clicking the top-level
MyHomePagewidget.A view of its properties and layout should open, and the VS Code editor should navigate to and focus the line where the widget was included.
-
Explore and try out other features in the widget inspector and Flutter sidebar.
-
{:.steps}
Congratulations! Now that you've installed and tried out Flutter, follow the Flutter learning pathway, set up development for an additional target platform, or explore some of these resources to continue your Flutter learning journey.
{% render "docs/get-started/setup-next-steps.html", site: site %}