79622712

Date: 2025-05-15 06:10:27
Score: 0.5
Natty:
Report link

I'm using FVM to manage different Flutter versions per project.

I want my shell to automatically use the Flutter SDK inside .fvm/flutter_sdk only when I'm inside a Flutter project, but not when I'm in my home directory or its subdirectories.

Here's the logic I'm currently using in my ~/.zshrc:

if [ -d ".fvm/flutter_sdk" ] && [[ "$PWD" != $HOME* ]]; then
  export PATH="$PWD/.fvm/flutter_sdk/bin:$PATH"
fi

Now, when I’m inside a project that uses FVM:

flutter --version

...automatically uses the project’s FVM version of Flutter, without me needing to type:

fvm flutter --version
Reasons:
  • RegEx Blacklisted phrase (1): I want
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Low reputation (0.5):
Posted by: Paras Palli