fvm version as default in VSCode not working - flutter

I added fvm to my project and set it up like this. Now I can run all the commands for example fvm use x.x.x or fvm flutter pub get. Everything works.
BUT when running the application through VSCode directly (Play button or shortcut) it always uses my latest install SDK version. Why is it not starting with the current flutter version ?
This is my settings.json:
{
"dart.flutterSdkPaths": [
"/Users/usr/fvm/versions"
],
// Remove .fvm files from search
"search.exclude": {
"**/.fvm": true
},
// Remove from file watching
"files.watcherExclude": {
"**/.fvm": true
}
}
What am I missing here? How do I configure fvm to work correctly with VSCode?

I'm assuming you have the .fvm folder set up properly? ie. It contains the symlink flutter_sdk (which points to the currently selected SDK) and the fvm_config.json.
In your settings.json file, you also need to set the location of the SDK itself:
"dart.flutterSdkPath": ".fvm/flutter_sdk",
Which will point to the same symlink.

Related

fvm keep requesting change flutter path

I am trying to use fvm on Windows.
Because my projects use mixed of languages, I need to change the version globally.
The problem is that it keeps asking me to change the flutter path.
At first,
So, I moved flutter path down to the bottom of fvm\default\bin.
Here is how I setup the path.
Now, if I change global flutter version again, the path is changed as the version of fvm, not the default... which is not in the path at all.
If it is just the message, I can ignore, but when I try to open up my project and try flutter --version the global version is not changed.
Can anybody guess what is the problem?
I did install with flutter pub global activate fvm.
I tried deactivate and activate again, removed reset the path in various ways, but keep getting same issue.
Another thing is I am keep getting Can't load Kernel binary: Invalid SDK hash message. I just assume this is kind of related to the first issue, but not of it.
Thanks.
I guess I solved this issue.
First of all, I had flutter installed version 1.22.6 at the beginning. and installed fvm with flutter pub global activate fvm. Then, the fvm version 1.3.7 installed. If I try to install flutter version 3.x.x, it fails with message like Internal Error: Could not infer Flutter Version 3.x.x or fvm version 1.3.7 doesn't support ~~~ something like that. So, I upgraded the actual flutter installed to the latest version, and also upgraded fvm to the latest version. Then, it never go back to 1.22.6 globally with the fvm.
So, I reinstalled the flutter version 1.22.6, complete uninstall fvm by flutter pub global deactivate fvm and also deleting fvm folder.(if you don't delete the folder and reinstall, it will install the same version of fvm you previously installed) And reinstall with flutter pub global activate fvm. Then, it will then install fvm 1.3.7 version. With this version of fvm, I couldn't install 3.0.2, but could install stable
but using different commands for this fvm 1.3.7 version.... like fvm use stable --global... you can find some commands here
it was because of the actual flutter version installed and fvm version I guess.... Please comment below if I was wrong.

How to clean uninstall flutter fvm package

which folder has to be delete for clean uninstall FVM package/Flutter Version Management ?
First apply the official uninstallation steps in the following page in the official docs for the package, select the platform from the taps above and check the Uninstall section.
If you want to also delete all the configs of FVM along with all the installed SDKs, you can type the following in the Terminal/Command Prompt:
fvm config
You will see an output similar to the following:
FVM Settings:
Located at C:\Users\moaze\fvm\.settings
cachePath: D:\Development\Flutter-SDK\versions
skipSetup: false
gitCache: false
You can see to paths in the output, one for the FVM Settings and one for the SDKs which is cachePath, you can delete both folders.

Flutter FVM .vscode/settings.json is gone

im using fvm to use flutter 1.22 for some purpose, already install everything for fvm and only change the path in settings.json but the file is not there in .vscode i cannot find it anywhere
You need to create the file manually.
.vscode/settings.json:
{
"dart.flutterSdkPath": ".fvm/flutter_sdk",
// Remove .fvm files from search
"search.exclude": {
"**/.fvm": true
},
// Remove from file watching
"files.watcherExclude": {
"**/.fvm": true
}
}
Source: Configure fvm for VSCode

Flutter version management. error : -bash: fvm: command not found

I am trying to install the flutter version manager to switch the flutter version among the different flutter projects.
I use the command to install the fvm - pub global activate fvm
but when I run the command on the terminal - fvm help
There is an error -bash: fvm: command not found
How to fix it ?
Your .pub-cache binaries are not yet added to your PATH variable, used by your terminal. Add path with the following command:
export PATH="$PATH:$HOME/.pub-cache/bin"
This is the location where fvm is installed. So by exporting this path to your PATH variable you should be able to get fvm working from anywhere in your terminal.
If you installed fvm using pub and you already have it in your path but you are still getting the error, follow these steps:
run dart pub cache repair // You may get an error: Failed to precompile fvm:main:. Just ignore that for now.
run dart pub global activate fvm
you can do a
flutter clean
then when its done, run
dart pub global activate fvm
when it's done it should work now, close the current bash terminal and open a new one
You must add the path to the fvm executable to the $PATH environment variable. After running "pub global activate fvm" you should have seen a warning with instructions on how to fix it. You can watch this: https://youtu.be/R6vKde1vIGQ
That will get you up and running.
if use windows 10 or later add system properties -> Environment Variables -> Path -> %USERPROFILE%\AppData\Local\Pub\Cache\bin
First confirm if fvm.bat is executing successfully, you should have the folder already in environment variable PATH(%USERPROFILE%\AppData\Local\Pub\Cache\bin). If it is then for fvm to run in bash, instead of fvm.bat, you need to create a shortcut, a file named fvm with no extension, the containing folder should also exist in PATH variable, the file contains location to fvm.bat and ends with a whitespace and S*.

Unignore Ionic Doctor Issue

I accidentally hit “Ignore forever” in an ionic doctor issue.
Is there any option to re-enable this issue? I looked in the projects config files but didn't find any changes. I also uninstalled / installed ionic but the issue is still ignored.
It seems to be setting an ignored array in config.json file in .ionic folder or app configuration folder present in home directory. It may be that it is not a project level setting but cli config level.
"state": {
"lastCommand": "date-stamp",
"doctor": {
"ignored": [
"app-scripts-update-available",
"ionic-native-update-available"
]
}
Deleting the contents of the array seems to show the ignored issues when doing ionic doctor check.