Flutter' is not an internal or external command

I have installed the Flutter SDK but when I run

flutter doctor

It says I haven’t. How do you fix this

I ran

flutter doctor

and was expecting there to be what I had which was recommended and what I didn’t have which was recommended. Instead I got this:

'flutter' is not an internal or external command.

The error 'flutter' is not an internal or external command usually occurs when the command line interface (CLI) cannot find the flutter executable. This is commonly due to an issue with setting up the PATH environment variable for Flutter. To resolve this issue, follow these steps:

Step 1: Verify the Flutter Installation Directory

First, make sure that you have correctly installed the Flutter SDK:

  1. Locate the directory where you installed the Flutter SDK. For example, you might have extracted the Flutter SDK to C:\flutter.
  2. Inside this directory, you should see the bin folder, which contains the Flutter executable.

Step 2: Set Up the PATH Environment Variable (Windows)

  1. Open Environment Variables:
  • Right-click on “This PC” or “My Computer” and select “Properties.”
  • Click on “Advanced system settings” on the left-hand side.
  • In the “System Properties” window, click on the “Environment Variables” button.
  1. Edit the PATH Variable:
  • In the “Environment Variables” window, find the “Path” variable under “System variables” (or “User variables” if you want it to apply only to your user account) and select it.
  • Click on “Edit.”
  1. Add Flutter to PATH:
  • Click “New” and add the path to the flutter\bin directory. For example, if you installed Flutter in C:\flutter, add C:\flutter\bin to the PATH.
  • Click “OK” to save your changes.
  1. Close and Reopen the Command Prompt:
  • After updating the PATH, close any open Command Prompt or PowerShell windows and open a new one.

Step 3: Verify the Installation

  • Open a new Command Prompt or PowerShell window and run:

bash

Copy code

flutter doctor
  • You should now see output from the flutter doctor command, listing any missing dependencies and setup requirements.

Step 4: Additional Checks (If the Issue Persists)

  1. Check Installation Location: Make sure the Flutter SDK is not installed in a path that contains spaces or special characters (e.g., C:\Program Files\flutter). If it does, consider moving the Flutter SDK to a simpler path, like C:\flutter.
  2. Restart Your Computer: If updating the PATH variable does not work immediately, try restarting your computer to ensure that the changes take effect.

After following these steps, running flutter doctor should work as expected, displaying a list of the necessary components and any further setup steps required.