Flutter enables you to build native desktop applications for Linux using the same codebase as your mobile and web apps. If you’re using Linux and want to develop Flutter desktop applications, this guide will walk you through the complete setup process for Linux desktop development.
System Requirements
Before we begin, make sure you have:
- Linux Distribution: Debian 11 or later, or Ubuntu 22.04 LTS or later
- Architecture: x86_64 (64-bit) system
- Storage: At least 2.5 GB of free disk space
- RAM: 4GB minimum, 8GB recommended for desktop development
- Internet connection: To download Flutter SDK and dependencies
- Sudo privileges: Administrative access for installing packages
Step 1: Install Basic Flutter Dependencies
First, update your system and install the core Flutter requirements:
sudo apt-get update -y && sudo apt-get upgrade -y
sudo apt-get install -y curl git unzip xz-utils zip libglu1-mesa
What these packages do:
curl
: Downloads files from the internetgit
: Version control system (required for Flutter)unzip
&xz-utils
: Extract compressed fileszip
: Create compressed archiveslibglu1-mesa
: OpenGL utility library
Step 2: Install Linux Desktop Development Tools
Install the specific packages required for Linux desktop app development:
sudo apt-get install \
clang cmake git \
ninja-build pkg-config \
libgtk-3-dev liblzma-dev \
libstdc++-12-dev
What these packages do:
clang
: C/C++ compiler for building native componentscmake
: Build system generatorninja-build
: Fast build systempkg-config
: Library configuration toollibgtk-3-dev
: GTK+ 3.0 development libraries (for native Linux UI)liblzma-dev
: LZMA compression librarylibstdc++-12-dev
: Standard C++ library development files
Step 3: Download Flutter SDK
Create a directory for Flutter and download the SDK:
mkdir -p ~/development
cd ~/development
Download the latest stable Flutter release:
wget https://storage.googleapis.com/flutter_infra_release/releases/stable/linux/flutter_linux_3.32.4-stable.tar.xz
Or if you prefer using curl:
curl -O https://storage.googleapis.com/flutter_infra_release/releases/stable/linux/flutter_linux_3.32.4-stable.tar.xz
Step 4: Extract Flutter SDK
Extract the downloaded Flutter SDK:
tar -xf flutter_linux_3.32.4-stable.tar.xz
This creates a flutter
directory in ~/development/
containing the Flutter SDK.
Step 5: Add Flutter to PATH
Add Flutter to your system PATH so you can run Flutter commands from anywhere.
First, check your default shell:
echo $SHELL
Then add Flutter to your PATH based on your shell:
For Bash users:
echo 'export PATH="$HOME/development/flutter/bin:$PATH"' >> ~/.bashrc
For Zsh users:
echo 'export PATH="$HOME/development/flutter/bin:$PATH"' >> ~/.zshrc
For Fish users:
fish_add_path -g -p ~/development/flutter/bin
Apply the changes:
source ~/.bashrc # or ~/.zshrc for Zsh users
Step 6: Enable Linux Desktop Support
Flutter requires you to explicitly enable desktop support:
flutter config --enable-linux-desktop
This command configures Flutter to support Linux desktop development.
Step 7: Verify Flutter Installation
Test that Flutter is properly installed and desktop support is enabled:
flutter --version
You should see output similar to:
Flutter 3.32.4 • channel stable • https://github.com/flutter/flutter.git
Framework • revision 0a3dcf... (2 weeks ago) • 2024-05-30 08:44:27 -0500
Engine • revision 6b9068a...
Tools • Dart 3.4.0 • DevTools 2.34.3
Check that desktop development is properly configured:
flutter devices
You should see „Linux (desktop)“ listed as an available device.
Step 8: Run Flutter Doctor
Flutter includes a diagnostic tool to check your setup:
flutter doctor
For Linux desktop development, ensure you see:
- ✅ Flutter (Channel stable, 3.32.4)
- ✅ Linux toolchain – develop for Linux desktop
Don’t worry about Android or other platform warnings if you’re only developing for Linux desktop.
Step 9: Install Development Environment
Install Visual Studio Code (Recommended):
For Ubuntu/Debian:
# Add Microsoft GPG key
wget -qO- https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > packages.microsoft.gpg
sudo install -o root -g root -m 644 packages.microsoft.gpg /etc/apt/trusted.gpg.d/
sudo sh -c 'echo "deb [arch=amd64,arm64,armhf signed-by=/etc/apt/trusted.gpg.d/packages.microsoft.gpg] https://packages.microsoft.com/repos/code stable main" > /etc/apt/sources.list.d/vscode.list'
sudo apt update
sudo apt install code
For Fedora:
sudo rpm --import https://packages.microsoft.com/keys/microsoft.asc
sudo sh -c 'echo -e "[code]\nname=Visual Studio Code\nbaseurl=https://packages.microsoft.com/yumrepos/vscode\nenabled=1\ngpgcheck=1\ngpgkey=https://packages.microsoft.com/keys/microsoft.asc" > /etc/yum.repos.d/vscode.repo'
sudo dnf install code
Install Flutter extension:
- Open VS Code
- Go to Extensions (Ctrl+Shift+X)
- Search for „Flutter“ and install the official Flutter extension
- This will also install the Dart extension automatically
Step 10: Create and Test Your First Desktop App
Create a new Flutter project specifically configured for desktop:
cd ~/development
flutter create --platforms=linux my_desktop_app
cd my_desktop_app
Run the desktop app:
flutter run -d linux
This will build and launch your Flutter app as a native Linux desktop application!
Step 11: Build for Distribution
When you’re ready to distribute your app, build a release version:
flutter build linux
The built application will be in build/linux/x64/release/bundle/
and can be distributed to other Linux systems.
What Gets Installed
Your Flutter desktop development setup includes:
- Flutter SDK: Core framework and tools
- Dart SDK: Programming language for Flutter
- Linux toolchain: Native compilation tools (clang, cmake, ninja)
- GTK+ libraries: For native Linux UI components
- VS Code extensions: Development environment enhancements
Important Notes
GTK+ Dependency: Flutter Linux apps use GTK+ for native integration, which is why we installed libgtk-3-dev
.
Desktop vs Mobile: Desktop Flutter apps have different UI considerations – larger screens, mouse input, keyboard shortcuts, and window management.
Distribution: Unlike mobile apps, desktop apps can be distributed directly as executables or through package managers like Snap, Flatpak, or AppImage.
Performance: Desktop Flutter apps run natively and offer excellent performance compared to web-based desktop frameworks.
Troubleshooting
Common issues and solutions:
- Flutter command not found:
- Restart your terminal or run
source ~/.bashrc
- Verify PATH is correctly set
- Restart your terminal or run
- Linux toolchain not found:
- Ensure all development packages are installed
- Run
flutter doctor -v
for detailed diagnostics
- GTK errors when running:
- Install missing GTK+ development libraries
- Check that
libgtk-3-dev
is properly installed
- Build failures:
- Verify clang and cmake are installed and working
- Check that all dependencies are up to date
- App won’t launch:
- Run with
flutter run -d linux -v
for verbose output - Check for missing runtime libraries
- Run with
Linux-Specific Development Tips
Window Management:
import 'package:window_manager/window_manager.dart';
// Set window size and properties
await windowManager.setMinimumSize(const Size(800, 600));
await windowManager.setTitle('My Flutter Desktop App');
System Integration:
- Use
path_provider
for accessing standard directories - Implement native file dialogs with
file_picker
- Add system tray support with appropriate packages
Theming:
// Respect system theme
ThemeMode themeMode = MediaQuery.of(context).platformBrightness == Brightness.dark
? ThemeMode.dark
: ThemeMode.light;
Alternative Installation Methods
Using official Flutter installation script:
# Download and run the official installer
curl -fsSL https://github.com/flutter/flutter/releases/download/stable/flutter_linux_3.32.4-stable.tar.xz | tar -xJ -C ~/development/
From GitHub releases: You can also download Flutter directly from the official GitHub releases page at https://github.com/flutter/flutter/releases
Uninstalling Flutter
To remove Flutter completely:
- Remove Flutter directory:
rm -rf ~/development/flutter
- Remove PATH entry from your shell configuration file (
.bashrc
,.zshrc
, etc.) - Optionally remove development packages:
sudo apt-get remove clang cmake ninja-build pkg-config libgtk-3-dev liblzma-dev libstdc++-12-dev
Next Steps
Now that Flutter is installed for Linux desktop development, you can:
- Build desktop-first Flutter apps with proper window management
- Explore desktop Flutter packages for native integration
- Learn desktop UI patterns different from mobile apps
- Package your apps for distribution via Snap, Flatpak, or AppImage
- Add platform channels for Linux-specific functionality
- Contribute to the Flutter desktop ecosystem
Keeping Flutter Updated
Flutter releases updates frequently with new features and bug fixes:
flutter upgrade
This command updates both Flutter and Dart to the latest stable versions.
Desktop Development Best Practices
Design Considerations:
- Design for larger screens and landscape orientation
- Implement proper keyboard navigation and shortcuts
- Consider mouse hover states and right-click menus
- Use desktop-appropriate components and layouts
Performance:
- Desktop apps can handle more complex UIs than mobile
- Take advantage of available screen real estate
- Implement proper window state management
- Consider multi-window support for advanced applications
Having trouble with your Flutter desktop development setup on Linux? Leave a comment and we’ll help you troubleshoot!