← Back to flutter/flutter

How to Deploy & Use flutter/flutter

Flutter SDK Deployment and Usage Guide

Prerequisites

System Requirements:

  • Operating System: Windows 10 or later (64-bit), macOS 10.14 (Mojave) or later, or Linux (64-bit)
  • Disk Space: 2.5 GB (does not include IDE/tools for target platforms)
  • Git: Version control system for cloning the repository
  • Tools:
    • Windows: PowerShell 5.0 or newer, Git for Windows
    • macOS: Xcode command line tools (xcode-select --install)
    • Linux: curl, git, unzip, xz-utils, zip, libglu1-mesa

Platform-Specific Requirements:

  • Android Development: Android Studio (latest stable) with Android SDK, SDK Platform-Tools, and Android SDK Command-line Tools
  • iOS/macOS Development: Xcode (latest stable), CocoaPods (sudo gem install cocoapods)
  • Web Development: Google Chrome
  • Windows Desktop: Visual Studio 2019 or later with "Desktop development with C++" workload
  • Linux Desktop: Clang, CMake, GTK development headers, Ninja build

Installation

1. Clone the Flutter Repository:

git clone https://github.com/flutter/flutter.git -b stable

2. Add Flutter to PATH:

# macOS/Linux (add to ~/.bashrc, ~/.zshrc, or ~/.bash_profile)
export PATH="$PATH:`pwd`/flutter/bin"

# Windows (PowerShell - add to system environment variables)
$env:PATH += ";$(pwd)\flutter\bin"
# Or via System Properties > Environment Variables > Path > Edit

3. Initialize Flutter (Auto-downloads Dart SDK):

flutter doctor

Note: On first run, Flutter automatically downloads the Dart SDK and other dependencies from Google servers. This also occurs when running flutter upgrade.

4. Pre-cache Development Binaries (Optional but recommended):

flutter precache

Configuration

Environment Variables:

# Optional: Set Flutter root explicitly
export FLUTTER_ROOT=/path/to/flutter

# Android SDK path (if not auto-detected)
flutter config --android-sdk /path/to/android/sdk

# Enable specific platforms (if disabled)
flutter config --enable-web
flutter config --enable-windows-desktop
flutter config --enable-macos-desktop
flutter config --enable-linux-desktop

Android Setup:

# Accept Android licenses
flutter doctor --android-licenses

IDE Configuration:

  • Visual Studio Code: Install "Flutter" and "Dart" extensions from marketplace
  • Android Studio/IntelliJ: Install Flutter and Dart plugins via Settings > Plugins

Proxy Configuration (if behind corporate firewall):

export HTTP_PROXY=proxy.company.com:8080
export HTTPS_PROXY=proxy.company.com:8080
export NO_PROXY=localhost,127.0.0.1

Build & Run

Create a New Project:

flutter create my_app
cd my_app

Run in Development Mode:

# List available devices
flutter devices

# Run on connected device/emulator with hot reload enabled
flutter run

# Run on specific device
flutter run -d <device_id>

# Run with verbose logging
flutter run -v

Hot Reload Usage:

  • Press r in terminal after saving code changes to hot reload
  • Press R for full restart
  • Press q to quit

Run Tests:

# Run unit tests
flutter test

# Run integration tests
flutter test integration_test/

Deployment

Android (APK/AAB):

# Build APK for testing
flutter build apk --release

# Build App Bundle for Play Store
flutter build appbundle --release

# Output location: build/app/outputs/flutter-apk/ or bundle/

iOS (Requires macOS + Xcode):

# Build for release
flutter build ios --release

# Build IPA for distribution
flutter build ipa --release

# Open in Xcode for signing and distribution
open ios/Runner.xcworkspace

Web:

# Build for production
flutter build web --release

# Build with specific renderer (canvaskit or html)
flutter build web --web-renderer canvaskit

# Deploy to Firebase Hosting, Netlify, or GitHub Pages
# Copy build/web/ contents to your web server

Desktop:

# Windows
flutter build windows --release

# macOS
flutter build macos --release

# Linux
flutter build linux --release

Distribution Platforms:

  • Mobile: Google Play Store, Apple App Store, Microsoft Store
  • Web: Firebase Hosting, Vercel, Netlify, AWS S3, GitHub Pages
  • Desktop: Microsoft Store (Windows), Mac App Store (macOS), Snap Store (Linux), or direct distribution

Troubleshooting

Flutter Doctor Issues:

Android toolchain incomplete:

# Install Android SDK Command-line Tools via Android Studio SDK Manager
# Then run:
flutter doctor --android-licenses

Xcode license not accepted:

sudo xcodebuild -license accept

CocoaPods not installed:

sudo gem install cocoapods

Common Build Errors:

Dart SDK download fails (corporate network):

  • Configure proxy settings (see Configuration section)
  • Or download Flutter from pre-packaged archive instead of git

Gradle build fails (Android):

cd android && ./gradlew clean && cd ..
flutter clean
flutter pub get

iOS build fails with "pod install" errors:

cd ios
pod deintegrate
pod install
cd ..

Performance Issues:

Slow hot reload:

  • Ensure using debug mode (flutter run, not --release)
  • Check for antivirus software scanning the build directory
  • Exclude project directory from real-time antivirus scanning

High memory usage during build:

# Limit Gradle memory usage
flutter build apk --no-shrink

Network/Connectivity:

If Flutter tools cannot reach Google servers (required for Dart SDK download, package updates):

  • Check flutter doctor for connectivity issues
  • Configure proxy settings in environment variables
  • For offline development, use flutter pub get --offline (requires prior package cache)

Getting Help: