Add Linux as a target platform for Flutter from web start

To add Linux as a Flutter app target for Linux, follow this procedure.

Install Linux compilation tools

#
  1. Allocate a minimum of 5 GB of storage for the Linux compilation tools.

  2. To develop linux apps, use the following command to install these packages:
    clang, cmake, ninja-build, pkg-config, libgtk-3-dev, libstdc++-12-dev

    $ sudo apt-get install \
          clang cmake git \
          ninja-build pkg-config \
          libgtk-3-dev liblzma-dev \
          libstdc++-12-dev

Check your development setup

#

help Help

Run Flutter doctor

#

The flutter doctor command validates that all components of a complete Flutter development environment for Linux.

  1. Open a shell.

  2. To verify your installation of all the components, run the following command.

    $ flutter doctor

As you chose to develop for Linux, you do not need all components. If you followed this guide, the result of your command should resemble:

Running flutter doctor...
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 3.19.3, on Ubuntu 20.04 (LTS), locale en)
[!] Android toolchain - develop for Android devices
[✓] Chrome - develop for the web
[!] Android Studio (not installed)
[✓] Linux toolchain - develop for Linux desktop
[✓] VS Code (version 1.86)
[✓] Connected device (1 available)
[✓] Network resources


! Doctor found issues in 2 categories.

Troubleshoot Flutter doctor issues

#

When the flutter doctor command returns an error, it could be for Flutter, VS Code, one of the Linux libraries, the connected device, or network resources.

If the flutter doctor command returns an error for any of these components, run it again with the verbose flag.

$ flutter doctor -v

Check the output for other software you might need to install or further tasks to perform.

If you change the configuration of your Flutter SDK or its related components, run flutter doctor again to verify the installation.

Start developing Linux desktop apps with Flutter

#

Congratulations! Now that you have installed all prerequisites and the Flutter SDK, you should be able to start developing Flutter apps for Linux desktop.