skip to content

In an FVM project, what do .fvmrc and .fvm/ contain, and how do you point VS Code and Android Studio at the pinned SDK?

level: middleimportance: should knowfreq 38%

answer

  1. flutter key plus flavors
  2. update* switches default true
  3. flutter_sdk link for JetBrains
  4. dart.flutterSdkPath for VS Code
  5. legacy fvm_config.json

basics

~20 s

.fvmrc is committed JSON holding the pinned flutter version, optional flavors and per-project switches; .fvm/ holds local links into the FVM cache. VS Code's dart.flutterSdkPath is set by FVM; Android Studio is pointed at .fvm/flutter_sdk manually.

solid answer

~40 s

`.fvmrc` is a JSON file at the project root: the `flutter` key holds the pinned version, `flavors` maps names to versions, and switches such as `updateVscodeSettings`, `updateGitIgnore`, `updateMelosSettings` and `runPubGetOnSdkChanges` (all true by default) control what `fvm use` touches. The `.fvm/` directory is local and ignored: `flutter_sdk` links to the cached SDK, `versions/<version>` is a second link, `version` and `release` are internal files, and a legacy `fvm_config.json` is still written for old tools. For VS Code, `fvm use` writes `dart.flutterSdkPath` into `.vscode/settings.json`, pointing at `.fvm/versions/<version>`; restart the terminal or window afterwards. Android Studio and IntelliJ are not changed automatically: set the Flutter SDK path to the project's `.fvm/flutter_sdk`, and re-check it after switching versions because the IDE may save the resolved cache path.

code

json · 3 lines
json
{
  "dart.flutterSdkPath": ".fvm/versions/3.47.5"
}

go deeper

for a junior

Know that .fvmrc holds the version and is committed, while .fvm/ is local, and that the IDE must use the project's SDK.

for a middle

Describe the .fvmrc keys and .fvm links, what fvm use writes for VS Code, and the manual Android Studio setting.

for a senior

Fix IDE and terminal disagreements: resolved cache paths in JetBrains, stale VS Code settings, missing links after a clone, and privilegedAccess on Windows.

for a principal

Standardise IDE configuration across a team so the editor, terminal and CI all build with the SDK the repository pins.

## Two locations, two purposes An FVM project has a **shared** part and a **local** part: | Item | Committed? | Purpose | |---|---|---| | `.fvmrc` | yes | the project's Flutter version and FVM settings | | `.fvm/` | no | links and metadata pointing into this machine's cache | Since FVM 3.0 the configuration moved from `.fvm/fvm_config.json` to `.fvmrc` so that `.fvm/` could be ignored. FVM still reads the old file when no `.fvmrc` exists, warning you to migrate by running `fvm use`, and still writes it alongside `.fvmrc` for tools that expect it. ## Inside .fvmrc ```json { "flutter": "3.47.5", "flavors": { "production": "3.44.3", "next": "beta" }, "updateVscodeSettings": true, "updateGitIgnore": true, "runPubGetOnSdkChanges": true } ``` - **`flutter`** — the pinned version: an exact release, a channel, a commit, or a fork-prefixed version. - **`flavors`** — named alternative versions for the same project, used by `fvm use <flavor>` and `fvm flavor <flavor> <command>`. - **`updateVscodeSettings`**, **`updateGitIgnore`**, **`updateMelosSettings`**, **`runPubGetOnSdkChanges`** — all default to true; set one to false to stop `fvm use` from touching that file or step. - **`cachePath`**, **`flutterUrl`**, **`useGitCache`**, **`privilegedAccess`** — rarer overrides for where and how SDKs are fetched and whether links are created. ## Inside .fvm/ - **`flutter_sdk`** — a link to the cached SDK directory; the stable path for tools and IDEs. - **`versions/<version>`** — another link to the same SDK, named after the version; VS Code is pointed here. - **`version`** and **`release`** — internal files recording the SDK version and release name. - **`fvm_config.json`** — the legacy configuration copy. With `privilegedAccess` false, which matters on Windows without symlink rights, FVM skips creating the links and IDE settings get absolute paths instead. If `.fvm/` is missing, for example after a fresh clone, `fvm use` or `fvm install` recreates it from `.fvmrc`. ## VS Code `fvm use` updates **`.vscode/settings.json`** (and a `.code-workspace` file if present): 1. It sets **`dart.flutterSdkPath`** to the relative path `.fvm/versions/<version>`. 2. The Dart and Flutter extensions then analyse, run and debug with that SDK. 3. FVM suggests restarting the integrated terminal so plain `flutter` there resolves to the project SDK. Set `updateVscodeSettings` to false if the team manages that file itself. ## Android Studio and IntelliJ FVM does **not** change JetBrains settings. Configure them by hand: 1. Open the Flutter settings for the project. 2. Set **Flutter SDK path** to the absolute project path ending in **`.fvm/flutter_sdk`**, or to `<fvm dir>/default` to use the global version. 3. After `fvm use` switches versions, confirm the IDE still stores the `.fvm/flutter_sdk` path. JetBrains IDEs can resolve the link and save the cache path of the old version, which silently keeps the old SDK. `fvm doctor` reports the project's pin and IDE-related paths, which helps when the IDE and the terminal disagree. ## Quick troubleshooting | Symptom | Likely cause | Fix | |---|---|---| | IDE says the Flutter SDK is missing after a clone | `.fvm/` is ignored, so the links do not exist yet | run `fvm install` or `fvm use` in the project root | | VS Code analyses with the wrong version | `updateVscodeSettings` is false, or the window was not reloaded | set `dart.flutterSdkPath`, reload the window | | Android Studio stays on the old version | the IDE saved a resolved cache path | reselect `.fvm/flutter_sdk` | | Terminal and IDE disagree | plain `flutter` in the terminal follows `PATH` | use `fvm flutter` or restart the integrated terminal |

  • Android Studio keeps using the old SDK after fvm use switched the project. Why?
    FVM retargets the `.fvm/flutter_sdk` link but does not edit JetBrains settings. If the IDE stored the resolved cache path of the old version instead of the link path, it keeps using that SDK. Reselect the Flutter SDK path as the project's `.fvm/flutter_sdk` and confirm the saved path still contains it.
  • Why did FVM move its configuration from .fvm/fvm_config.json to .fvmrc?
    The config had to be committed while the links in `.fvm/` must not be, since they point into one machine's cache. Moving the config to a root-level `.fvmrc` lets the whole `.fvm/` directory go into `.gitignore`. FVM still reads the old file when `.fvmrc` is missing and writes a legacy copy for older tools.

saying these in an interview costs you the question

  • Commits .fvm/flutter_sdk so teammates share the link
  • Expects fvm use to update Android Studio's SDK path automatically
  • Points the IDE at a cache folder instead of the project link
  • Edits .fvm/fvm_config.json and expects it to override .fvmrc
  • Confuses .fvmrc flavors with Flutter build flavors