0% found this document useful (0 votes)
73 views

Flutter - Linux Install

This document provides instructions for installing Flutter on Linux. It lists the system requirements including operating system, disk space, and required tools. It describes two methods for installing Flutter - using snapd or manually downloading and extracting the Flutter SDK. It also provides instructions for adding Flutter to the system path and running flutter doctor to check for any missing dependencies.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
73 views

Flutter - Linux Install

This document provides instructions for installing Flutter on Linux. It lists the system requirements including operating system, disk space, and required tools. It describes two methods for installing Flutter - using snapd or manually downloading and extracting the Flutter SDK. It also provides instructions for adding Flutter to the system path and running flutter doctor to check for any missing dependencies.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

8/9/2021 Flutter | Linux install

Get sta ed with Flu er 2.2. See What's new in docs, including a list of the new instructor-led video workshops!


Get sta ed Set up an edi

Linux install
1. Install

2. Set up an editor

3. Test drive
Docs  Get started  Install  Linux
4. Write your rst app

5. Learn more

Contents
From another pla orm?

Flu er for Android devs System requirements


Flu er for iOS devs Get the Flutter SDK

Flu er for React Native devs Install Flutter using snapd


Flu er for web devs Install Flutter manually
Run utter doctor
Flu er for Xamarin.Forms devs
Update your path
Introduction to declarative UI
Update path directly
Da language overview Android setup
Building a web app Install Android Studio
Set up your Android device
Samples & tutorials  Set up the Android emulator
 Agree to Android Licenses
Development
Linux setup


User inte ace


Additional Linux requirements
Data & backend Enable desktop support
Accessibility & internationalization Web setup
Pla orm integration Next step

Packages & plugins

Add Flu er to existing app

Tools & features System requirements


Migration notes

To install and run Flutter, your development environment must meet these minimum requirements:
Testing & debugging 
Operating Systems: Linux (64-bit)
Pe ormance & optimization  Disk Space: 600 MB (does not include disk space for IDE/tools).
Tools: Flutter depends on these command-line tools being available in your environment.
Deployment  bash
curl
Resources  file
 git 2.x
Reference mkdir
Who is Dash? rm
unzip
Widget index
which
API reference
xz-utils
u er CLI reference zip
Package site Shared libraries: Flutter test command depends on this library being available in your environment.
libGLU.so.1 - provided by mesa packages such as libglu1-mesa on Ubuntu/Debian and mesa-libGLU on Fedora.

Get the Flu er SDK


On Linux, you have two ways you can install Flutter.

Install Flu er using snapd


The easiest way to install Flutter on Linux is by using snapd. For more information, see Installing snapd.

Once you have snapd, you can install Flutter using the Snap Store, or at the command line:

$ sudo snap install flutter --classic

Note: Once the snap is installed, you can use the following command to display your Flutter SDK path:

$ flutter sdk-path 

https://flutter.dev/docs/get-started/install/linux 1/5
8/9/2021 Flutter | Linux install

Install Flu er manually


If you don’t have snapd, or can’t use it, you can install Flutter using the following steps.

Get sta ed 1. Download the following installation bundle to get the latest stable release of the Flutter SDK:
1. Install
u er_linux_2.2.3-stable.tar.xz
2. Set up an editor

3. Test drive
For other release channels, and older builds, see the SDK releases page.
4. Write your rst app
2. Extract the le in the desired location, for example:
5. Learn more

$ cd ~/development
From another pla orm?
$ tar xf ~/Downloads/flutter_linux_2.2.3-stable.tar.xz
Flu er for Android devs

Flu er for iOS devs


If you don’t want to install a xed version of the installation bundle, you can skip steps 1 and 2. Instead, get the source code
Flu er for React Native devs
from the Flutter repo on GitHub with the following command:
Flu er for web devs

Flu er for Xamarin.Forms devs $ git clone https://github.com/flutter/flutter.git


Introduction to declarative UI

Da language overview You can also change branches or tags as needed. For example, to get just the stable version:

Building a web app


$ git clone https://github.com/flutter/flutter.git -b stable
Samples & tutorials 
 3. Add the flutter tool to your path:
Development

$ export PATH="$PATH:`pwd`/flutter/bin"


User inte ace

Data & backend

Accessibility & internationalization This command sets your PATH variable for the current terminal window only. To permanently add Flutter to your path, see
Update your path.
Pla orm integration

Packages & plugins 4. Optionally, pre-download development binaries:


Add Flu er to existing app
The flutter tool downloads platform-speci c development binaries as needed. For scenarios where pre-downloading thes
Tools & features artifacts is preferable (for example, in hermetic build environments, or with intermittent network availability), iOS and Androi
Migration notes binaries can be downloaded ahead of time by running:

Testing & debugging  $ flutter precache


Pe ormance & optimization 
For additional download options, see flutter help precache.
Deployment  You are now ready to run Flutter commands!

Resources 
 Note: To update an existing version of Flutter, see Upgrading Flutter.
Reference

Who is Dash?

Widget index
Run u er doctor
API reference
Run the following command to see if there are any dependencies you need to install to complete the setup (for verbose output, ad
u er CLI reference
the -v ag):
Package site

$ flutter doctor

This command checks your environment and displays a report to the terminal window. The Dart SDK is bundled with Flutter; it is n
necessary to install Dart separately. Check the output carefully for other software you might need to install or further tasks to
perform (shown in bold text).

For example:

[-] Android toolchain - develop for Android devices


• Android SDK at /Users/obiwan/Library/Android/sdk
✗ Android SDK is missing command line tools; download from https://goo.gl/XxQghQ
• Try re-installing or updating your Android SDK,
visit https://flutter.dev/setup/#android-setup for detailed instructions.

The following sections describe how to perform these tasks and nish the setup process.

Once you have installed any missing dependencies, run the flutter doctor command again to verify that you’ve set everything u
correctly.

Warning: The flutter tool uses Google Analytics to anonymously report feature usage statistics and basic crash reports.
This data is used to help improve Flutter tools over time.

https://flutter.dev/docs/get-started/install/linux 2/5
8/9/2021 Flutter | Linux install

Flutter tool analytics are not sent on the very rst run. To disable reporting, type flutter config --no-analytics. To display
the current setting, type flutter config. If you opt out of analytics, an opt-out event is sent, and then no further information
is sent by the Flutter tool.

 By downloading the Flutter SDK, you agree to the Google Terms of Service. Note: The Google Privacy Policy describes how
Get sta ed data is handled in this service.

1. Install
Moreover, Flutter includes the Dart SDK, which may send usage metrics and crash reports to Google.
2. Set up an editor

3. Test drive

4. Write your rst app

5. Learn more
Update your path
You can update your PATH variable for the current session at the command line, as shown in Get the Flutter SDK. You’ll probably
 From another pla orm? want to update this variable permanently, so you can run flutter commands in any terminal session.
Flu er for Android devs
The steps for modifying this variable permanently for all terminal sessions are machine-speci c. Typically you add a line to a le t
Flu er for iOS devs
is executed whenever you open a new window. For example:
Flu er for React Native devs

Flu er for web devs


1. Determine the path of your clone of the Flutter SDK. You need this in Step 3.
2. Open (or create) the rc le for your shell. For example, Linux uses the Bash shell by default, so edit $HOME/.bashrc. If you a
Flu er for Xamarin.Forms devs
using a different shell, the le path and lename will be different on your machine.
Introduction to declarative UI 3. Add the following line and change [PATH_OF_FLUTTER_GIT_DIRECTORY] to be the path of your clone of the Flutter git repo:
Da language overview

Building a web app $ export PATH="$PATH:[PATH_OF_FLUTTER_GIT_DIRECTORY]/bin"

Samples & tutorials  4. Run source $HOME/.<rc file> to refresh the current window, or open a new terminal window to automatically source the
 5. Verify that the flutter/bin directory is now in your PATH by running:
Development


User inte ace $ echo $PATH


Data & backend

Accessibility & internationalization Verify that the flutter command is available by running:
Pla orm integration

Packages & plugins $ which flutter

Add Flu er to existing app

Tools & features


Note: As of Flutter’s 1.19.0 dev release, the Flutter SDK contains the dart command alongside the flutter command so
Migration notes
that you can more easily run Dart command-line programs. Downloading the Flutter SDK also downloads the compatible
version of Dart, but if you’ve downloaded the Dart SDK separately, make sure that the Flutter version of dart is rst in your
Testing & debugging  path, as the two versions might not be compatible. The following command tells you whether the flutter and dart
commands originate from the same bin directory and are therefore compatible.
Pe ormance & optimization 
Deployment  $ which flutter dart 
/path-to-flutter-sdk/bin/flutter
/usr/local/bin/dart
Resources 

Reference As shown above, the two commands don’t come from the same bin directory. Update your path to use commands from
/path-to-flutter-sdk/bin before commands from /usr/local/bin (in this case). After updating your shell for the change
Who is Dash? to take effect, running the which command again should show that the flutter and dart commands now come from the
Widget index same directory.
API reference

u er CLI reference $ which flutter dart 


/path-to-flutter-sdk/bin/flutter
Package site
/path-to-flutter-sdk/bin/dart

To learn more about the dart command, run dart -h from the command line, or see the dart tool page.

Update path directly


In some cases, your distribution may not permanently acquire the path when using the above directions. When this occurs, you ca
change the environment variables le directly. These instructions require administrator privileges:

1. Determine the path of your clone of the Flutter SDK.

2. Locate the etc directory at the root of the system, and open the profile le with root privileges.

$ sudo nano /etc/profile

3. Update the PATH string with the location of your Flutter SDK directory.

https://flutter.dev/docs/get-started/install/linux 3/5
8/9/2021 Flutter | Linux install

if [ "`id -u`" -eq 0 ]; then


PATH="..."
else
PATH="/usr/local/bin:...:[PATH_OF_FLUTTER_GIT_DIRECTORY]/bin"
 fi
Get sta ed
export PATH
1. Install

2. Set up an editor 4. End the current session or reboot your system.


3. Test drive
5. Once you start a new session, verify that the flutter command is available by running:

4. Write your rst app


$ which flutter
5. Learn more

For more details on setting the path in Bash, see this StackExchange question. For information on setting the path in Z shell, see t
From another pla orm?
StackOver ow question.
Flu er for Android devs

Flu er for iOS devs

Android setup
Flu er for React Native devs

Flu er for web devs

Flu er for Xamarin.Forms devs

Introduction to declarative UI
Note: Flutter relies on a full installation of Android Studio to supply its Android platform dependencies. However, you can
Da language overview
write your Flutter apps in a number of editors; a later step discusses that.
Building a web app

Samples & tutorials 


Development
 Install Android Studio
1. Download and install Android Studio.


User inte ace


2. Start Android Studio, and go through the ‘Android Studio Setup Wizard’. This installs the latest Android SDK, Android SDK
Data & backend
Command-line Tools, and Android SDK Build-Tools, which are required by Flutter when developing for Android.
Accessibility & internationalization
3. Run flutter doctor to con rm that Flutter has located your installation of Android Studio. If Flutter cannot locate it, run
Pla orm integration flutter config --android-studio-dir <directory> to set the directory that Android Studio is installed to.
Packages & plugins

Set up your Android device


Add Flu er to existing app

Tools & features

Migration notes To prepare to run and test your Flutter app on an Android device, you need an Android device running Android 4.1 (API level 16) or
higher.
Testing & debugging 
1. Enable Developer options and USB debugging on your device. Detailed instructions are available in the Android documentat
Pe ormance & optimization  2. Windows-only: Install the Google USB Driver.
3. Using a USB cable, plug your phone into your computer. If prompted on your device, authorize your computer to access your
Deployment  device.
4. In the terminal, run the flutter devices command to verify that Flutter recognizes your connected Android device. By defa
Resources  Flutter uses the version of the Android SDK where your adb tool is based. If you want Flutter to use a different installation of
 Android SDK, you must set the ANDROID_SDK_ROOT environment variable to that installation directory.
Reference

Who is Dash?
Set up the Android emulator
Widget index
To prepare to run and test your Flutter app on the Android emulator, follow these steps:
API reference

u er CLI reference 1. Enable VM acceleration on your machine.


Package site 2. Launch Android Studio, click the AVD Manager icon, and select Create Virtual Device…
In older versions of Android Studio, you should instead launch Android Studio > Tools > Android > AVD Manager and
select Create Virtual Device…. (The Android submenu is only present when inside an Android project.)
If you do not have a project open, you can choose Con gure > AVD Manager and select Create Virtual Device…
3. Choose a device de nition and select Next.
4. Select one or more system images for the Android versions you want to emulate, and select Next. An x86 or x86_64 image i
recommended.
5. Under Emulated Performance, select Hardware - GLES 2.0 to enable hardware acceleration.
. Verify the AVD con guration is correct, and select Finish.

For details on the above steps, see Managing AVDs.

7. In Android Virtual Device Manager, click Run in the toolbar. The emulator starts up and displays the default canvas for your
selected OS version and device.

Agree to Android Licenses


Before you can use Flutter, you must agree to the licenses of the Android SDK platform. This step should be done after you have
installed the tools listed above.

1. Make sure that you have a version of Java 8 installed and that your JAVA_HOME environment variable is set to the JDK’s folde

Android Studio versions 2.2 and higher come with a JDK, so this should already be done.

2. Open an elevated console window and run the following command to begin signing licenses.

https://flutter.dev/docs/get-started/install/linux 4/5
8/9/2021 Flutter | Linux install

$ flutter doctor --android-licenses

3. Review the terms of each license carefully before agreeing to them.


 4. Once you are done agreeing with licenses, run flutter doctor again to con rm that you are ready to use Flutter.
Get sta ed

1. Install

2. Set up an editor

3. Test drive
Linux setup
4. Write your rst app

5. Learn more Warning: Beta! This area covers desktop support, which is available as a beta release. Beta support still has notable
feature gaps, including accessibility support. You can try a beta snapshot of desktop support on the stable channel, or you
 From another pla orm?
can keep up with the latest changes to desktop on the beta channel. For more information, see the Desktop section in What’s
Flu er for Android devs new in Flutter 2, a free article on Medium.
Flu er for iOS devs

Flu er for React Native devs

Flu er for web devs


Additional Linux requirements
Flu er for Xamarin.Forms devs

Introduction to declarative UI For Linux desktop development, you need the following in addition to the Flutter SDK:

Da language overview Clang


Building a web app CMake
GTK development headers
Samples & tutorials  Ninja build
 pkg-con g
Development
Run the following command


User inte ace

Data & backend


$ sudo apt-get install clang cmake ninja-build pkg-config libgtk-3-dev
Accessibility & internationalization

Pla orm integration

Packages & plugins Enable desktop suppo


Add Flu er to existing app
At the command line, perform the following command to enable desktop support
Tools & features

Migration notes
$ flutter config --enable-linux-desktop
Testing & debugging 
For more information, see Desktop support for Flutter
Pe ormance & optimization 


Web setup
Deployment

Resources 
 Flutter has support for building web applications in the stable channel. Any app created in Flutter 2 automatically builds for the w
Reference
To add web support to an existing app, follow the instructions on Building a web application with Flutter when you’ve completed t
Who is Dash? setup above.

Widget index

API reference

u er CLI reference Next step


Package site

Set up your preferred editor.

Set up an edi

utter-dev@ • terms • brand usage • security • privacy • español • 社区中⽂资源 • 한국어 • We stand in solidarity with the Black community. Black Lives Matter.
Except as otherwise noted, this work is licensed under a Creative Commons Attribution 4.0 International License, and code samples are licensed under the BSD License.

https://flutter.dev/docs/get-started/install/linux 5/5

You might also like