'Flutter - Error: Unable to create dart snapshot for flutter tool

When I run flutter change channel or flutter doctor, the CMD show me this:

C:\Users\MyUser>flutter doctor -v
Checking Dart SDK version...

Building flutter tool...

Running pub upgrade...

/C:/src/flutter/packages/flutter_tools/lib/src/aot.dart:144:5: Warning: Must explicitly return a value from a non-void function.
    return;
    ^

When I run:

git clean -xfd

git pull

flutter doctor

The CDM show me this:

fatal: not a git repository (or any of the parent directories): .git

How can I solve it? Thank you



Solution 1:[1]

Had the same issue...Copied the flutter_tools from flutter download and replaced with the same folder in my installation then ran flutter doctor from command in administrator mode. Funny the issue started 3 days ago for me too.

Solution 2:[2]

1.Go the Flutter install directory and please run (in cmd)

git clean -xfd

git stash save --keep-index

git stash drop

git pull

2.and restart your computer then run

flutter doctor

3.then go to your project path run

flutter packages get

flutter run

Solution 3:[3]

I had the exact same problem yesterday, i tired to run

git clean -xfd

git pull

flutter doctor

in cmd and i kept getting:

fatal: not a git repository (or any of the parent directories): .git

eventually i gave up and i deleted the old flutter sdk directory from my PC as well as the path from Enviroment Variables and i downloded the new sdk and setup flutter again and now it's running fine

https://docs.flutter.dev/get-started/install

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Babatunde Ahmed
Solution 2
Solution 3 asirabdelhady