Whenever I have a problem with Flutter I often find answers saying 'reinstall the Flutter SDK'.
However I cannot find any clear instructions on how to do this (please direct me to them if I am wrong).
General Questions
By 'clear' instructions, I mean ones that answer the following questions:
What folder(s) should be deleted to remove Flutter from my computer?
Do any files need to be copied and added to the new Flutter folder once I reinstall it?
Do I need to make any changes to my Flutter projects either before or after reinstalling Flutter?
Will I need to download the same channel (stable, beta, dev, master) as what I am currently on?
Will I need to make any changes to my PATH?
Are these the correct steps to reinstall?
Go to https://flutter.dev/docs/development/tools/sdk/releases?tab=macos
Download the zip of the release you want (safest to use latest stable version)
Open Flutter zip in SAME location as the previous Flutter folder was
Done - I should now be able to run Flutter projects without any further steps
Apologies if these seem like very basic questions but for someone fairly new it isn't obvious what the answers are.
I'm new to Flutter and had similar issues. I will outline what worked for me but meanwhile, to answer your questions:
What folder(s) should be deleted to remove Flutter from my computer?
The Flutter folder which you unzipped and, presumably added to $PATH. Although not deleting it isn't going to pose an issue. I have separate folders of different versions of Flutter on my computer and it's fine.
Do any files need to be copied and added to the new Flutter folder
once I reinstall it?
Try a fresh download of Flutter and unzip it? There is no need to copy or add any files to the Flutter folder once you've (re)installed it.
Do I need to make any changes to my Flutter projects either before or
after reinstalling Flutter?
Not exactly sure what you mean by make changes to your Flutter projects. If you ran flutter doctor and didn't get any errors, then it's good to go. When you create a new Flutter project either in Android Studio, VS Code or Terminal, it will automatically handle whatever file copying business.
Will I need to download the same channel (stable, beta, dev, master)
as what I am currently on?
No, you only need one. I suggest you download one from Stable unless you need web support, which would be Beta.
Will I need to make any changes to my PATH?
After you've unzipped your fresh copy of Flutter (note the folder destination), open Terminal and change the path to said folder destination but make sure it's the /bin folder you're mapping to.
Are these the correct steps to reinstall?
Go to
https://flutter.dev/docs/development/tools/sdk/releases?tab=macos
Download the zip of the release you want (safest to use latest stable
version) Open Flutter zip in SAME location as the previous Flutter
folder was Done - I should now be able to run Flutter projects without
any further steps
Yes and no. You're missing a number of steps. Please follow the full Flutter installation guide depending on your OS.
It took me about 10 hours over two days and a VPN to finally get it working in China with an old install from two years ago when I was in Montréal.
Related
My debug mode does not work as I see the unverified breakpoint notice in VSCode in debug mode.
I already checked the Launch json file and it is fine, but something else is wrong which I do not see what it is. Maybe something related to paths, etc.
I tried to make a new project in VSCode using the command and the new default Flutter project is OK.
So it seems like, if I can make a fresh project from my current project then my problem could be solved. But how? I tried to move my files from my current project to the newly made Default Flutter project but I do not think this is the way. Because I guess some of the files in my project are the source of issues...
I already deleted .vs file but no help.
Do you have any good idea how to fix this issue?
First try cleaning the project files using flutter clean then flutter pub get, try running the app without debugging and if you are down for making a new one just move the lib and assets folders and copy the content of pubspec.yaml file.
It does not affect anything but size of project - hence git push takes forever.
I already tried deleting it once but it appears again once flutter run and continues where it stopped making new folders with every fresh run or so.
I am using MacOS
Let me know if you need more information!
Appreciate any help!
So apparently my mac optimized the storage and deleted some (unused) parts of the project which triggered flutter to make the new folders. In the end I needed to compress the whole project to be able to move it on the internal disk (somewhere on user) and then deleted all extra folders with the initial folders. I then ran the command flutter create . to create all folders. After a flutter clean it was running without any problems or creating extra folders.
Lesson learned: never create a flutter project within iCloud Drive folders.
Whenever I try to run a dart tool like Dart Migrate I get the following error and I am unable to run that tool. Is there a way to solve this problem or I have to reinstall Flutter?
Btw every thing is okay with Flutter Doctor
After a lot of effort and wasting a lot of time on this issue I have been able to solve this problem. I have installed dart-sdk separately in the past and place the path of that dart-sdk at the top (before flutter one) in environment variables PATH. So I deleted that old dart-sdk path and deleted the respective folder this solved my problem.
In VS Code, if you get "Can't Load Kernel binary: Invalid SDK Hash" in Flutter or Dart, update dart.sdkPath setting
If you get this in VS Code, in addition to re-downloading the dart-sdk, make sure the "dart.sdkPath" setting in user/workspace settings is pointing to the new SDK. In my case, even though I had it in my path as in Junaid's answer, VS Code was still looking to the old dart-sdk folder and giving me the kernel hash error. I updated the dart.sdkPath to the correct path and restarted VS Code:
For example, in Windows:
Download dart sdk
Unzip it to c:\tools\dart-sdk or any other folder (make sure you rename or delete the existing dart-sdk folder)
ctrl-shift-p, type 'user settings (JSON)', open the json settings, and add:
"dart.sdkPath": "C:\\tools\\dart-sdk",
Update your system PATH environmental variable to point to the new dart-sdk and delete the reference to the old location.
Restart VS Code.
Note that Instead of This "dart.sdkPath": "D:\Dart\dart-sdk\bin" work well for me.
path should be included '\bin' also. It work for me
I need some help in solving this problem in flutter installation
i Installed flutter put when running flutter doctor show an error
./flutter/bin/flutter: line 46: /c/src/flutter/flutter/bin/cache/dart-sdk/bin/pub: No such file or directory
Error: Unable to 'pub upgrade' flutter tool. Retrying in five seconds... (8 tries left)
Go inside flutter SDK
you have to delete the cache folder inside bin and it will help you.
Thanks!
I dont know whether u downloaded git or not, cloned it or not
so I recommend u to follow step by step as directed on this site-
https://flutter.dev/docs/get-started/install/windows
and the question u asked can be solved if u copy the location of flutter.bin which is located in flutter directory after cloning git, and set path of that particular files in environment variables.
you can find environment variables on right clicking on this pc icon >properties>advanced system setting>environment variables>click on path if dont have create a new path,if having select it >edit >and paste location there.
run flutter doctor.
that's it.
in my case, when I cancel the flutter upgrade in the middle of using an Android Studio then the flutter becomes unreadable again, then when I when the flutter in the terminal will be like this:
... flutter/bin/cache/dart-sdk/bin/dart: No such file or directory
then the solution is quite easy.
go to where the directory folder is / flutter / bin / cache /
Delete the dart-sdk folder
rename the dart-sdk.old folder to dart-sdk only
finished, your flutter is working again.
This question already has answers here:
copy project / folder flutter to another computer
(3 answers)
Closed 4 years ago.
I have created flutter app on ios device, built and ran successfully on simulator.
I have taken that code to my windows machine. When I opened the project on visual studio code, I get following error.
main.dart issue
after running flutter clean, I get this error(it seems that on ios machine the flutter path is different then on windows)
flutter clean
When I move app created in windows to ios, by changing the paths in .packages file, I was able to remove the error but the files and folders which I had added and referenced in main.dart file, the project was unable to locate that.Even the intellisense doesn't show my files.
Basically I want to know the way maintain my code which I can reuse on both environment.
Thanks,
You need to run flutter packages get when you move the code from one machine to another.
Actually you should delete all directories and files listed in .gitignore.
These files contain machine specific paths that likely don't match from one machine to another.
Using git to pass changes (clone/commit/pull) would do this automatically.
A related issue Improve error output for projects copyied from another machine. #26014