With desktop support, you can compile Flutter source code to a native macOS Desktop app. Flutter’s desktop support also extends to plugins—you can install existing plugins that support the macOS platform, or you can create your own.
This page covers desktop support for macOS which is available as an alpha release as of 1.13. This page does not cover Windows or Linux platforms, which are in technical preview. You can try Windows and Linux platform support by reading the Desktop shells page in the Flutter wiki.
To create a Flutter app with desktop support, you need the following software:
- Flutter SDK. See the Flutter SDK installation instructions.
- Optional: An IDE that supports Flutter. You can install Android Studio, IntelliJ IDEA, or Visual Studio Code and install the Flutter and Dart plugins to enable language support and tools for refactoring, running, debugging, and reloading your desktop app within an editor. See the IDE support section for more details.
You must be on the master flutter build release channel and enable the macOS desktop platform feature:
$ flutter channel master $ flutter upgrade $ flutter config --enable-macos-desktop
Create and run
Create and/or navigate to the directory for your new project
using the following commands.
myapp with the name you would like to use for your project.
$ mkdir myapp $ cd myapp
Once you have navigated to your root project directory, use the following commands to create and run the Flutter starter app as a new desktop project:
$ flutter create . $ flutter run -d macOS
To generate a release build run the following command:
$ flutter build macos
Add desktop support to an existing Flutter project
To add desktop support to an existing project, run the following command in a terminal from the root project directory:
$ flutter create .
To run your project as a desktop app, use the following command:
$ flutter run -d macOS
You can create, run, and debug a Flutter project with desktop support using the existing Dart and Flutter extensions for Android Studio and IntelliJ as well as Visual Studio Code. Follow the instructions to set up an editor and install the Dart and Flutter extensions (also referred to as editor plugins).
VS Code: Create and run a new project with desktop support
Creating a new project with desktop support is no different than creating a new Flutter project for other platforms. Running a Flutter desktop app is no different than running and debugging in VS Code for other target platforms:
- Select macOS as a target device from the VS Code status bar.
- Click the Debug > Start Without Debugging or press F5.
Android Studio and IntelliJ IDEA: Create and run a new project with desktop support
Creating a new project with desktop support is no different than creating a new Flutter project for other platforms. To run a Flutter project with desktop support, use the same process for [running and debugging Flutter projects in Android Studio and IntelliJ] with other target platforms:
- Select macOS (desktop) from the target selector dropdown menu in the Flutter extension toolbar.
- Click the Play icon in the toolbar, or invoke Run > Run.
Flutter Desktop supports both using and creating plugins.
To use a plugin that supports macOS, follow the steps for plugins in using packages. Flutter automatically adds the necessary native code to your project, as with iOS or Android.
- Add the latest version of the plugin to
flutter pub get.
The following plugins have macos desktop support:
To create a plugin with desktop support you should use the following resources:
You can run the following samples as desktop apps, as well as download and inspect the source code to learn more about Flutter desktop support.
- Flutter Gallery
- A samples project hosted on GitHub to help developers evaluate and use Flutter. The Gallery consists of a collection of material design widgets, behaviors, and vignettes implemented with Flutter. You can clone the project and run Gallery as a desktop app by following the provided instructions in the README.
- Photo Search app
- A sample app built as a desktop application that uses
the following desktop-specific plugins:
Stay tuned for updates on desktop support! We will continue to develop desktop support for Mac, Windows, and Linux.