Flutter Desktop Application

Requirements

To compile a desktop application, you must build it on the targeted platform: build a Windows application on Windows, a macOS application on macOS, and a Linux application on Linux.

To create a Flutter application with desktop support, you need the following software:

Additional Platform Specific Requirements

Check if set-up is correct

  • Check if everything is set-up correctly as described here

Creating Flutter project with Desktop support

When you create a new Flutter project you can indicate which platforms you want to support, by default chosen only Android and iOS, but you can enable all 6 platforms

Screen Shot 2022-08-07 at 2 14 30 PM

After creating a project, you should run the following commands in a terminal from the root project directory:

  • flutter pub get (This command gets all the dependencies listed in the pubspec.yaml file in the current working directory, as well as their transitive dependencies)
  • Run the Desktop application using the command: flutter run

Enabling Desktop support for existing project

To add desktop support to an existing Flutter project, run the following command in a terminal from the root project directory: flutter create --platforms=windows,macos,linux This adds the necessary desktop files and directories to your existing Flutter project. To add only specific desktop platforms, change the platforms list to include only the platform(s) you want to add.

Build a release app

To generate a release build, run one of the following commands: flutter build windows flutter build macos flutter build linux