'Flutter - running command "flutter _____" instantly closes terminal

Dealing with some significant frustration trying to set up my environment variables just to run Flutter. in my path, I've tried many suggestions to try setting up my Path route so that the Flutter Console (or cmd) can successfully run the command "flutter doctor" just to download all the packages, etc. But the problem is as soon as I run this command, it instantly closes my terminal. There isn't anything happening, the terminal just closes. Any help would be appreciated, and I've attached my screenshots of my Path envs to maybe help out some more. envs



Solution 1:[1]

I also get the same problem i.e whenever I hit the flutter doctor command; the terminal instantly closes. Solution : Add the following to the system variable path.

C:\Windows\System32\WindowsPowerShell\v1.0

everything will work fine

Solution 2:[2]

I was facing the same issue and I resolved it: the problem was PowerShell version.
I am using Windows 8 and by default it has version 4.
Flutter needs version 5.0, so I upgraded my PowerShell.

Solution 3:[3]

Add this to system variable PATH:

C:\Windows\System32\WindowsPowerShell\v1.0

Open cmd as admin and set variables:

setx /M FLUTTER_HOME "C:\flutter" <---- here folder where your flutter is
setx /M PATH "%FLUTTER_HOME%\bin;%PATH%"

Solution 4:[4]

Add PowerShell path to your PATH in environment variables if not exists.

In my case C:\Windows\System32\WindowsPowerShell\v1.0 added to the PATH

Solution 5:[5]

Note: Flutter relies on a full installation of Android Studio to supply its Android platform dependencies. However, you can write your Flutter apps in a number of editors; a later step discusses that.

(https://flutter.dev/docs/get-started/install/windows) You could try to install android studio on your machine and try again.

Solution 6:[6]

Download Flutter SDK again and change your Flutter SDK path and update new path in environment variable and restart your IDE

Solution 7:[7]

The problem is of powershell only. In my case I mistakenly used ; at the end of path which was creating problem.

Solution 8:[8]

Perhaps it's like when you run a bat file and Windows closes it because there's no pause command at the end?

When I ran a bat file with the same command from sublime, i saw that it said this in sublime's output...

C:\!\flutter>flutter doctor 
Error: The Flutter directory is not a clone of the GitHub project.
       The flutter tool requires Git in order to operate properly;
       to set up Flutter, run the following command:
       git clone -b stable https://github.com/flutter/flutter.git

Solution: Put your folder at C:\flutter. I don't know why but it fixed this. My PATH is C:\flutter\bin. The "location of the sdk" is C:\flutter.

Solution 9:[9]

Add Only these in the path and it will surely work. ONLY FOR WINDOWS

enter image description here

Solution 10:[10]

I have the solution

  1. go to C:/ in windows
  2. create a src folder
  3. into your src folder run this git clone -b stable https://github.com/flutter/flutter.git
  4. setup your env variables with this path= C:/src/flutter

problem solved!