To install and run Flutter on a Chromebook, your machine must have Linux enabled from the Developers tab of Settings.
The amount of disk space required varies depending on which target platforms you enable. We recommend that you increase the disk size for the Linux environment from the default of 10GB to 32GB or larger, to accommodate Android Studio and other tooling.
Get the Flutter SDK
Install the core development tools needed for Flutter:
$ sudo apt install clang cmake ninja-build pkg-config libgtk-3-dev
This downloads the compiler toolchain needed to compile apps for ChromeOS.
Download Flutter from the Flutter repo on GitHub with the following command in your home directory:
$ git clone https://github.com/flutter/flutter.git -b stable
fluttertool to your path:
$ echo PATH="$PATH:`pwd`/flutter/bin" >> ~/.profile $ source ~/.profile
You are now ready to run Flutter commands!
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
$ flutter doctor
This command checks your environment and displays a report to the terminal window. The Dart SDK is bundled with Flutter; it is not 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).
[-] Android toolchain - develop for Android devices ✗ Unable to locate Android SDK. Install Android Studio from: https://developer.android.com/studio/index.html
The following sections describe how to perform these tasks and finish the setup process.
Once you have installed any missing dependencies, run the
command again to verify that you’ve set everything up correctly.
Configuring web app support
On ChromeOS, you do development work in a Linux container. However, the Chrome browser itself is part of the parent ChromeOS operating system, and Flutter doesn’t have a means to call it with the required parameters.
Track this issue at Issue 121462: Improve the web debugging experience on Chromebooks.
Instead, the best approach is to manually install a second copy of Chrome in the Linux container. You can do that with the following steps:
$ wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb $ sudo apt install ./google-chrome-stable_current_amd64.deb
Configuring Android app support
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, platform tools and build tooling that are required by Flutter when developing for Android.
- From the welcome dialog, choose More Actions -> SDK Manager. From the SDK Tools tab, select Android SDK Command-line Tools (latest) to install additional necessary tooling.
- Accept Android licenses.
$ flutter doctor --android-licenses
Deploy to your Chromebook
To deploy apps directly to your Chromebook, you need to do the following:
- Enable ADB in Settings. Note that this requires you to reboot your device once.
- In the Terminal, run
flutter devices. If prompted, authorize access to the Android container. Verify that
flutter deviceslists your ChromeOS device as a recognized device.
Set up your Android device
To prepare to run and test your Flutter app on an attached device, you need an Android device running Android 4.1 (API level 16) or higher.
- Enable Developer options and USB debugging on your device. Detailed instructions are available in the Android documentation.
- Using a USB cable, plug your phone into your computer. On your Chromebook, you may see a notification for “USB device detected”. Click on “Connect to Linux” If prompted on your Android device, authorize your computer to access your device.
- In the terminal, run the
flutter devicescommand to verify that Flutter recognizes your connected Android device. By default, Flutter uses the version of the Android SDK where your
adbtool is based. If you want Flutter to use a different installation of the Android SDK, you must set the
ANDROID_SDK_ROOTenvironment variable to that installation directory.
Set up your preferred editor.