协作头脑风暴
brainstorming
在实现前澄清需求、探索设计选择,并形成清晰的开发方向。
dev-swarm-flutter-installation【开发与工程】Install and configure Flutter SDK. Use when setting up a Flutter development environment.
独立 GitHub 快照 · 自动分类 · 以原作者文档为准
This skill assists in installing and configuring the Flutter SDK for cross-platform mobile, web, and desktop development.
macOS:
curl and unzipLinux:
curl, git, unzip, xz-utils, zip, libglu1-mesaWindows:
As an expert in your assigned roles, you must announce your actions before performing them using the following format:
As a {Role} [and {Role}, ...], I will {action description}
This communication pattern ensures transparency and allows for human-in-the-loop oversight at key decision points.
Before installing, check if Flutter is already installed.
flutter --version
If installed, display the current version and ask the user for confirmation before reinstalling or updating.
Determine the user's platform:
# macOS/Linux
uname -s
uname -m
# Windows (PowerShell)
$env:OS
[System.Environment]::Is64BitOperatingSystem
macOS:
xcode-select --install
Linux (Debian/Ubuntu):
sudo apt-get update -y && sudo apt-get upgrade -y
sudo apt-get install -y curl git unzip xz-utils zip libglu1-mesa
Windows: Ensure Git for Windows is installed. If not, guide user to download from: https://git-scm.com/download/win
Important: The Flutter SDK download URLs follow this pattern:
https://storage.googleapis.com/flutter_infra_release/releases/stable/macos/flutter_macos_<version>-stable.ziphttps://storage.googleapis.com/flutter_infra_release/releases/stable/macos/flutter_macos_arm64_<version>-stable.ziphttps://storage.googleapis.com/flutter_infra_release/releases/stable/linux/flutter_linux_<version>-stable.tar.xzhttps://storage.googleapis.com/flutter_infra_release/releases/stable/windows/flutter_windows_<version>-stable.zipTo get the latest stable version, check: https://docs.flutter.dev/release/archive
For simplicity, use the latest download links:
macOS (Intel):
cd ~/Downloads
curl -O https://storage.googleapis.com/flutter_infra_release/releases/stable/macos/flutter_macos-stable.zip
macOS (Apple Silicon/ARM64):
cd ~/Downloads
curl -O https://storage.googleapis.com/flutter_infra_release/releases/stable/macos/flutter_macos_arm64-stable.zip
Linux:
cd ~/Downloads
curl -O https://storage.googleapis.com/flutter_infra_release/releases/stable/linux/flutter_linux-stable.tar.xz
Windows (PowerShell):
cd $env:USERPROFILE\Downloads
Invoke-WebRequest -Uri "https://storage.googleapis.com/flutter_infra_release/releases/stable/windows/flutter_windows-stable.zip" -OutFile "flutter_windows-stable.zip"
macOS:
# Create recommended directory
mkdir -p ~/develop
# Extract (adjust filename based on architecture)
unzip ~/Downloads/flutter_macos-stable.zip -d ~/develop/
# OR for Apple Silicon:
# unzip ~/Downloads/flutter_macos_arm64-stable.zip -d ~/develop/
Linux:
# Create recommended directory
mkdir -p ~/develop
# Extract
tar -xf ~/Downloads/flutter_linux-stable.tar.xz -C ~/develop/
Windows (PowerShell):
# Create recommended directory (avoid paths with spaces/special characters)
New-Item -Path "$env:USERPROFILE\develop" -ItemType Directory -Force
# Extract
Expand-Archive -Path "$env:USERPROFILE\Downloads\flutter_windows-stable.zip" -Destination "$env:USERPROFILE\develop\"
macOS (Zsh - default shell):
# Add to ~/.zprofile
echo 'export PATH="$HOME/develop/flutter/bin:$PATH"' >> ~/.zprofile
# Apply changes (or restart terminal)
source ~/.zprofile
Linux (Bash):
# Add to ~/.bash_profile
echo 'export PATH="$HOME/develop/flutter/bin:$PATH"' >> ~/.bash_profile
# Apply changes (or restart terminal)
source ~/.bash_profile
Linux (Zsh):
# Add to ~/.zshenv
echo 'export PATH="$HOME/develop/flutter/bin:$PATH"' >> ~/.zshenv
# Apply changes (or restart terminal)
source ~/.zshenv
Linux (Fish):
# Add to PATH
fish_add_path -g -p ~/develop/flutter/bin
Windows (PowerShell as Administrator):
# Get current user PATH
$currentPath = [Environment]::GetEnvironmentVariable("Path", "User")
# Add Flutter to PATH
$flutterPath = "$env:USERPROFILE\develop\flutter\bin"
if ($currentPath -notlike "*$flutterPath*") {
[Environment]::SetEnvironmentVariable(
"Path",
"$flutterPath;$currentPath",
"User"
)
Write-Host "Flutter added to PATH. Please restart your terminal."
}
Alternative for Windows (Manual):
%USERPROFILE%\develop\flutter\binAfter configuring PATH, close and reopen all terminal windows and IDEs, then verify:
flutter --version
dart --version
Flutter includes a diagnostic tool to check your environment:
flutter doctor
This command checks for:
Follow any recommendations from flutter doctor to complete the setup.
After successful installation, save the Flutter setup information to dev-swarm/user_preferences.md for future reference.
Example:
Create or update dev-swarm/user_preferences.md with:
## Flutter Development
- **Flutter SDK**: Installed and configured (version X.X.X)
- **Dart**: Included with Flutter SDK
- **Installation path**: ~/develop/flutter
Command not found after installation:
~/develop/flutter/bin/flutter%USERPROFILE%\develop\flutter\bin\flutter.batPermission errors (macOS/Linux):
# Ensure proper permissions
chmod -R u+w ~/develop/flutter
Windows PATH issues:
After installation, users typically need to:
flutter create my_appcd my_app && flutter run