Skip to main content

setup-frontend.sh

Automates the complete Flutter frontend setup process.

Purpose

Sets up the Flutter development environment by verifying installation, fetching dependencies, and enabling desktop support for your platform.

Location

Must be run from the scripts/ directory:

cd scripts
./setup-frontend.sh

What It Does

  1. Validates Flutter installation - Checks Flutter SDK and runs flutter doctor
  2. Installs dependencies - Runs flutter pub get
  3. Enables platform support - Configures desktop support for Linux/macOS/Windows
  4. Cleans previous builds - Runs flutter clean to ensure a fresh start

Prerequisites

  • Flutter SDK 3.10 or higher
  • Platform-specific tools:
    • Linux: libgtk-3-dev, libblkid-dev, liblzma-dev
    • macOS: Xcode Command Line Tools
    • Windows: Visual Studio 2022 with C++ tools

Output

On success, displays:

✓ Flutter 3.x.x (channel stable)
✓ Dependencies installed successfully

Frontend Setup Complete!

Next Steps

After running this script:

  1. Start the frontend:

    ./start-frontend.sh
    # or
    ./start-dev.sh # starts both backend and frontend
  2. Or build for release:

    cd ../frontend
    flutter build linux # or macos, windows, apk, ios

Platform Detection

The script automatically detects your platform:

  • Linux: Enables Linux desktop support
  • macOS: Enables macOS desktop support
  • Windows: Enables Windows desktop support

Linux Dependencies

On Linux, you may need to install additional packages:

sudo apt-get install clang cmake ninja-build pkg-config libgtk-3-dev liblzma-dev

The script will display a reminder if these are needed.

Troubleshooting

Flutter not found

Add Flutter to your PATH:

export PATH="$PATH:/path/to/flutter/bin"
# Add to ~/.bashrc or ~/.zshrc to persist

flutter doctor issues

Run and fix reported issues:

flutter doctor

Common fixes:

  • Android: Install Android Studio
  • iOS: Install Xcode (macOS only)
  • Linux: Install GTK development libraries

Dependencies conflict

cd frontend
flutter clean
flutter pub get

Source Code

Located at: scripts/setup-frontend.sh

Key features:

  • Platform auto-detection
  • Color-coded output
  • flutter doctor health check
  • Automatic desktop enablement