SDK Management
flutter_compile lets you install, switch, and pin multiple Flutter SDK versions with isolated pub caches.
Installing SDKs
Install from a channel to get the latest version on that channel:
flutter_compile sdk install stable
flutter_compile sdk install beta
flutter_compile sdk install dev
flutter_compile sdk install master
Or install a specific version:
flutter_compile sdk install 3.24.0
flutter_compile sdk install 3.22.3
The first SDK installed is automatically set as the global default.
Force re-install
To remove and re-install an existing SDK:
flutter_compile sdk install stable --force
Listing SDKs
flutter_compile sdk list
Output shows all installed versions with markers:
Flutter SDKs:
3.24.0 (global)
3.22.3 (project)
3.19.0
stable
contributor
Use --json for machine-readable output:
flutter_compile sdk list --json
Setting the Global Default
The global default SDK is used in all terminals unless overridden by a project pin.
# Show current global
flutter_compile sdk global
# Set global
flutter_compile sdk global 3.24.0
This updates ~/.flutter_compilerc with the global_sdk_version key and modifies the shell PATH via ~/.flutter_compile_env.
Pinning to a Project
Pin an SDK version to a specific project by creating a .flutter-version file:
cd my_flutter_app
flutter_compile sdk use 3.22.3
Show the current pinned version:
flutter_compile sdk use
When a project has a .flutter-version file, the sdk exec command and IDE extensions will use that version instead of the global default.
Executing Through the Resolved SDK
Run any command using the resolved SDK (project pin → global default):
flutter_compile sdk exec flutter doctor
flutter_compile sdk exec flutter run
flutter_compile sdk exec dart analyze
flutter_compile sdk exec dart format .
The resolution order is:
- Project
.flutter-versionin the current directory or parents - Global default from
~/.flutter_compilerc
Removing SDKs
flutter_compile sdk remove 3.19.0
Per-SDK PUB_CACHE Isolation
Each installed SDK uses its own .pub-cache directory:
~/flutter_compile/versions/3.24.0/.pub-cache
~/flutter_compile/versions/3.22.3/.pub-cache
This prevents dependency conflicts between SDK versions. When running sdk exec, the PUB_CACHE environment variable is automatically set to the resolved SDK's cache.
FLUTTER_COMPILE_SDK Environment Variable
Since v0.12.0, IDE extensions set the FLUTTER_COMPILE_SDK environment variable in terminal sessions. This ensures IDE terminals use the project-pinned SDK instead of the global default.
The shell env file (~/.flutter_compile_env) uses a conditional guard:
- If
FLUTTER_COMPILE_SDKis set (by an IDE extension), the terminal uses that path - Otherwise, the global default SDK is used
Run flutter_compile migrate to update existing env files to the new guarded format.
Storage Layout
| Path | Contents |
|---|---|
~/flutter_compile/versions/ | All installed SDK versions |
~/flutter_compile/versions/<ver>/ | SDK root (contains bin/flutter) |
~/flutter_compile/versions/<ver>/.pub-cache/ | SDK-specific pub cache |
~/.flutter_compilerc | Global SDK version (global_sdk_version key) |
.flutter-version | Project-pinned version (in project root) |