Configures a Linux environment (Debian/Ubuntu or ChromeOS) for Flutter desktop application development by installing required system prerequisites, managing OS-specific configurations, and validating the toolchain.
-
Determine the Host Operating System:
STOP AND ASK THE USER: "Are you setting up this Flutter environment on a standard Debian/Ubuntu Linux distribution, or on a Chromebook (ChromeOS)?"
-
Handle ChromeOS Prerequisites (Conditional):
If the user indicates they are on a Chromebook:
Instruct the user to navigate to their ChromeOS Settings, turn on "Linux development environment", and ensure it is fully updated.
STOP AND ASK THE USER: "Please confirm once Linux support is enabled and updated so we can proceed with the package installation."
-
Update System Packages:
Execute the following command to refresh the package lists and upgrade existing packages:
bash
sudo apt-get update -y && sudo apt-get upgrade -y
-
Install Core Prerequisites:
Install the base dependencies required for Flutter to operate and build on Linux:
bash
sudo apt-get install -y curl git unzip xz-utils zip libglu1-mesa
-
Install Linux Desktop Toolchain:
Install the specific C/C++ toolchain and GTK libraries required to compile Linux desktop applications:
bash
sudo apt-get install -y clang cmake ninja-build pkg-config libgtk-3-dev libstdc++-12-dev
-
IDE Configuration Prompt:
STOP AND ASK THE USER: "For the best experience, an IDE with Flutter support is recommended. Would you like me to provide the installation commands for Visual Studio Code or Android Studio?"
- If VS Code: Provide the snap installation command:
sudo snap install --classic code
- If Android Studio: Provide the snap installation command:
sudo snap install android-studio --classic
-
Validate the Environment:
Run the Flutter diagnostic tool to verify the Linux toolchain and device availability:
bash
flutter doctor -v
flutter devices
Validate-and-Fix: Analyze the output of
.
- If the "Linux toolchain" section reports missing dependencies, parse the missing package names, construct a new
sudo apt-get install -y <packages>
command, and execute it.
- If does not list a platform device, verify that the package was successfully installed and re-run the validation.