How to Setup Flutter on ChromeOS?

October 16, 2023, . open book4 minutes read

Google’s newly released Flutter framework uses a single codebase system to create quick, efficient, and attractive apps. Despite various development frameworks, Flutter has its own importance in the IT sector. It stands out in the market thanks to a number of advantages it offers over other platforms. Mobile app trends change daily, and it is getting harder to create future-proof apps. Moving forward, we’ll talk about how to set up Flutter on ChromeOS.

Flutter has a simple installation procedure in addition to having such advantageous and practical capabilities for creating apps. You must ensure that your system satisfies the prerequisites before installing flutter.

System requirements

To set up and run Flutter on a Chromebook, Linux must be enabled in the Developers tab of your settings

Disk spaces needed vary according to the target platforms you enable. To accommodate Android Studio and other tooling, you should raise the Linux environment’s disk size from the normal 10GB to 32GB or more.

Get the Flutter SDK

Use the command below to 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.

Use the command below in your home directory to download Flutter from the Flutter repository on GitHub:

git clone -b stable

Then add the flutter tool to your path:

echo PATH="$PATH:`pwd`/flutter/bin" >> ~/.profile
source ~/.profile

From here, you are ready to run Flutter commands.

Run flutter doctor

Run the following command to determine if there are any dependencies you need to install to finish the setup:

flutter doctor

When you run this command, your environment is examined, and a report is shown in the terminal window. Flutter already includes the Dart SDK; Dart does not need to be installed separately. Check the output carefully for any further applications you might need to install or tasks you still need to complete (usually indicated in bolded text).

Configuring web app support

You work in a Linux container to develop ChromeOS applications. Flutter does not provide a way to call the Chrome browser with the necessary arguments because it is a component of the parent ChromeOS operating system.

The best course of action is to manually install a second instance of Chrome within the Linux container.

sudo apt install ./google-chrome-stable_current_amd64.deb

Configuring Android app support

Install Android Studio

  1. Download and install Android Studio.
  2. Go through the “Android Studio Setup Wizard” after starting Android Studio. This sets up the most recent versions of the platform tools, build tooling, and Android SDK that Flutter needs to work with for creating Android apps.
  3. To access the SDK Manager, select More Actions from the welcome dialog. To install additional required tooling, choose Android SDK Command-line Tools (latest) from the SDK Tools menu.
  4. Finally, Accept Android licenses with the command below:
flutter doctor --android-licenses

Deploy to your Chromebook

The following needs to be done in order to immediately deploy apps to your Chromebook:

  1. In Settings, turn on ADB. You must restart your device once as a result.
  2. Run flutter devices in the Terminal. Authorize access to the Android container if required. Check to see if your ChromeOS device is shown as a recognized device on flutter devices.

Set up your Android device

You need an Android device running Android 5.0 (API level 21) or higher in order to set up your Flutter app for running and testing on an associated device.

On your device, enable USB debugging and Developer settings. You may find comprehensive instructions in the Android documentation.

Connect your phone to your computer with a USB cable. You might notice a notification saying “USB device detected” on your Chromebook. “Connect to Linux” should be clicked. Authorize your PC to access your Android device if prompted.

To make sure Flutter sees your connected Android device, use the flutter devices command in the terminal. The Android SDK version on which your adb tool is based is the one that Flutter uses by default. Set the ANDROID_SDK_ROOT environment variable to the new installation path if you want Flutter to utilize a different Android SDK installation.

Share on

Author: Learndevtools

Like the article? Please share or subscribe to get more updates from Learndevtools