System requirements
To install and run Flutter, your development environment must meet these minimum requirements:
- Operating Systems: Linux (64-bit)
- Disk Space: 600 MB (does not include disk space for IDE/tools).
- Tools: it depends on these command-line tools being available in your environment.
bash
curl
file
git 2.x
mkdir
rm
unzip
which
xz-utils
zip
- 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.
Install Flutter using snapd
Once you have snapd, you can install it using the Snap Store, or at the command line:
$ sudo snap install flutter --classic
You can use the following command to display your Flutter SDK path:
$ flutter sdk-path
Install manually
Download the following installation bundle to get the latest stable release of the Flutter SDK:
flutter_linux_2.2.2-stable.tar.xz
- Extract the file in the desired location, for example:
$ cd ~/development
$ tar xf ~/Downloads/flutter_linux_2.2.2-stable.tar.xz
- You can get the source code from the Flutter repo on GitHub with the following command:
$ git clone https://github.com/flutter/flutter.git
- Get just the stable version:
$ git clone https://github.com/flutter/flutter.git -b stable
- Add the flutter tool to your path:
$ export PATH="$PATH:pwd/flutter/bin"
- Optionally, pre-download development binaries:
- The flutter tool downloads platform-specific development binaries as needed.
$ flutter precache
Run flutter doctor
Run the following command to see if there are any dependencies you need to install to complete the setup (for verbose output, add the -v flag):$ flutter doctor
Update your path
- Determine the path of your clone of the Flutter SDK. You need this in Step 3.
- Open (or create) the rc file for your shell. For example, Linux uses the Bash shell by default, so edit $HOME/.bashrc. If you are using a different shell, the file path and filename will be different on your machine.
- Add the following line and change [PATH_OF_FLUTTER_GIT_DIRECTORY] to be the path of your clone of the Flutter git repo:
$ export PATH="$PATH:[PATH_OF_FLUTTER_GIT_DIRECTORY]/bin"
- Run source $HOME/. to refresh the current window, or open a new terminal window to automatically source the file.
- Verify that the flutter/bin directory is now in your PATH by running:
$ echo $PATH
- Verify that the flutter command is available by running:
$ which flutter
Update path directly
Determine the path of your clone of the Flutter SDK.
Locate the etc directory at the root of the system, and open the profile file with root privileges.
$ sudo nano /etc/profile
Update the PATH string with the location of your Flutter SDK directory.if [ "'id -u'" -eq 0 ]; then
PATH="…"
else
PATH="/usr/local/bin:…:[PATH_OF_FLUTTER_GIT_DIRECTORY]/bin"
fi
export PATH
End the current session or reboot your system.
Once you start a new session, verify that the flutter command is available by running:$ which flutter
Android setup: Install Android Studio
Download and install Android Studio.
Start Android Studio, and go through the ‘Android Studio Setup Wizard’. This installs the latest Android SDK, Android SDK Command-line Tools, and Android SDK Build-Tools, which are required by Flutter when developing for Android.
Set up your Android device
- Enable Developer options and USB debugging on your device. Detailed instructions are available in the Android documentation.
- Windows-only: Install the Google USB Driver.
- Using a USB cable, plug your phone into your computer. If prompted on your device, authorize your computer to access your device.
- In the terminal, run the flutter devices command to verify that Flutter recognizes your connected Android device. By default, Flutter uses the version of the Android SDK where your adb tool is based. If you want to use a different installation of the Android SDK, you must set the ANDROID_SDK_ROOT environment variable to that installation directory.
Set up the Android emulator
- Enable VM acceleration on your machine.
- 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 Configure > AVD Manager and select Create Virtual Device…
- Choose a device definition and select Next.
- Select one or more system images for the Android versions you want to emulate, and select Next. An x86 or x86_64 image is recommended.
- Under Emulated Performance, select Hardware – GLES 2.0 to enable hardware acceleration.
- Verify the AVD configuration is correct, and select Finish.
- 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.
Linux setup
Additional Linux requirements
For Linux desktop development, you need the following in addition to the SDK:
- Clang
- CMake
- GTK development headers
- Ninja build
- pkg-config
- Run the following command
- $ sudo apt-get install clang cmake ninja-build pkg-config libgtk-3-dev
Enable desktop support
At the command line, perform the following command to enable desktop support
$ flutter config –enable-linux-desktop
Web setup
Flutter has support for building web applications in the stable channel. Any app created in Flutter 2 automatically builds for the web. To add web support to an existing app, follow the instructions on Building a web application with it when you’ve completed the setup above.
Happy Coding:)
Discover more from CODE t!ps
Subscribe to get the latest posts sent to your email.