Terminal & editor

Domains: Flutter


 Create the app

Do you also want to run your Flutter app on the web? The web version of Flutter is available as an early support release, meaning that features are missing and it’s not yet ready for production use. If you want to try it out, follow these instructions.

Use the flutter create command to create a new project:

$ flutter create myapp
$ cd myapp

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

Tip: The code for your app is in lib/main.dart. For a high-level description of what each code block does, see the comments at the top of that file.

Run the app

  1. Check that an Android device is running. If none are shown, follow the device-specific instructions on the Install page for your OS.

    		$ flutter devices
  2. Run the app with the following command:

    		$ flutter run

After the app build completes, you’ll see the starter app on your device.

Try hot reload

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. Make a change to app source, 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 lib/main.dart.
  2. Change the string

    		'You have pushed the button this many times'


    		'You have clicked the button this many times'

    Important: Do not stop your app. Let your app run.

  3. Save your changes.
  4. Type r in the terminal window.

You’ll see the updated string in the running app almost immediately.

Profile or release runs

Important: Do not test the performance of your app with debug and hot reload enabled.

So far you’ve been running your app in debug mode. Debug mode trades performance for useful developer features such as hot reload and step debugging. It’s not unexpected to see slow performance and janky animations in debug mode. Once you are ready to analyze performance or release your app, you’ll want to use Flutter’s “profile” or “release” build modes. For more details, see Flutter’s build modes.

Important: If you’re concerned about the package size of your app, see Measuring your app’s size. 


Similar pages

Page structure