This error message usually appears when the Flutter SDK is not properly installed or added to the system's PATH variable.
To fix this issue, you can follow these steps:
-
Make sure that the Flutter SDK is properly installed on your system. You can download it from the official Flutter website.
-
Add the Flutter bin directory to your system's PATH variable. You can do this by opening your terminal and running the following command:
export PATH="$PATH:[PATH_TO_FLUTTER_GIT_DIRECTORY]/flutter/bin"
Replace [PATH_TO_FLUTTER_GIT_DIRECTORY] with the actual path to your Flutter installation directory.
You can also add this line to your ~/.bashrc file to make the changes permanent.
-
Restart your terminal or source your ~/.bashrc file by running the following command:
source ~/.bashrc
-
Try running the flutter command again in your terminal. It should work now.
If these steps don't solve the issue, you can try reinstalling Flutter or checking if there are any issues with your system's PATH variable.
To know more, join our Flutter Certification Course today.