Flutter commands not showing anything - powershell

When I type flutter --version or flutter doctor in powershell, nothing is showing, a command prompt like window is opened for half a second and goes.
I can't see the output of the commands
I have downloaded flutter.
After the download when I first run the commands it was working in powershell and after that it is not working.please help I am a beginner.

Flutter require the powershell version 5.0 or newer.So check the version and update and also type that command in command prompt to check flutter is installed successfully or not.

Related

Unable to run flutter command on VS code terminal

as You can see each time i run commands on the terminal they just doesnt work
when i run flutter doctor using the command palette everything is installed fine
click to see photo
i didnt add the flutter path in the "environment variables for your account" doing so solved the problem
You just do not write the commands correctly, the error says that you have typed extra unwanted characters such as + sign, so read the error again and try to copy-paste the following command to the VS Code Terminal and see if it worked or not:
flutter doctor

Flutter running with no response after first installation in Windows

I'm new in flutter and trying to learn about it for the first time.
I'm following the instruction of flutter documentation in here
When in step to the setting environment, I follow the instruction here.
After restarting the pc, the next step I must running the command flutter doctor in cmd.
In this step, I get stuck because in cmd, flutter doesn't response anything.
I try to execute flutter inside VSCode It still stuck with loading.
I also try to running with android studio, Still the same, I get stuck with loading
What should I do?
I missed the important thing.
Just don't put it in the privilege directory.

Weird behavior of flutter and dart commands in PowerShell and CMD

I'm relatively new to Flutter but I already have developed and finished some Apps in Flutter.
Recently I noticed a weird behavior of commands with the keywords "dart" or "flutter" in it.
Here is an example:
I was trying to migrate an existing project to the new dart null-safety and typed the command dart migrate into my Visual-Studio-Code Terminal.
I was expecting an output like Migrating C:\.... as a response but instead got these three lines:
The command "git" is either misspelled or could not be found.
Building flutter tool...
Running pub upgrade...
and then the expected output:
Migrating C:\<project path>...
and so on.
So basically the commands work as they would normally do but I get these three lines before the output everytime. And it's not only with this command. Also basic commands like dart help or flutter doctor will get these three lines.
I don't know what I am doing wrong. I uninstalled Flutter and also removed it from the PATH and then reinstalled it freshly but it's still the same. I also searched the web but didn't found anyone who has the same problem.
Any help and explanation would be great. Thank you for your time :)
I think I know where the problem is. I ran the commands directly when I opened PowerShell. But the directory was something like C:\Windows\ and then it won't work.
After I did cd C:\Users\User all commands will work as expected.
I was just thinking that it doesn't matter from where I run dartand fluttercommands obviously you have to be in your user directory that they will work properly.

"flutter doctor" stucked, none of the flutter command working

I am running flutter on my windows machine, it was working earlier and I have created demo project with it.
Today when I run VSCode it asked me to update flutter and I did, but when it is updated it is not able to run any command. It doesn't do anything, neither error nor success. It just get stucked with any flutter command.
Note : It was working earlier, so there is no chance of setting environment variables, still I have double checked it and it is there.
I did not find any solution for this so the last available approach for me was to reinstall flutter SDK and it worked.
Note: If you are windows user, you might get an error about PowerShell version, you must have PowerShell version greater than 5.1

What is the Flutter Console?

As I am following the 'Get Started' documentation on Flutter for Windows, out of nowhere, there is a reference to the 'Flutter Console':
You are now ready to run Flutter commands in the Flutter Console!
Later the documentation request you to ...
In the Flutter Console, run the following command to see if there are
any dependencies you need to install to complete the setup:
$ flutter doctor
What is this magical 'Flutter Console'?
Earlier, they describe Flutter depends on PowerShell 5.0; is PowerShell the Flutter Console?
The documentation lists an optional step to add the flutter 'bin' folder to PATH environment variables "[i]f you wish to run Flutter commands in the regular Windows command prompt". This does not seem optional to me, as running flutter doctor is not recognized in PowerShell (which for the time being I will assume is the Flutter Console). I did run flutter.bat, but this window closed after some time. Perhaps this was supposed to be the Flutter Console?
Did I miss something in the setup?
flutter_console.bat is located in the root of your Flutter folder and not in the sub-folder called bin, e.g. ..\flutter\flutter_console.bat and ..\flutter\bin\flutter.bat are the files you have mistaken. You checked the bin folder. Here is a screenshot of the Flutter Console.
The image should explain what it does, it allows you to access flutter commands, which are calling the flutter.bat. That is the reason why you cannot interact with the latter when double-clicking it because you are not sending any parameters and it is not configured as a console window, i.e. it does not pause and wait for more input.
The Flutter Console just lets you execute commands in the right directory if you have not added it to PATH because if you have ..\flutter\bin\ in PATH you can access the flutter commands from anywhere.
The Flutter Console is a specific terminal window shipped with the Flutter installation bundle for windows.
It is installed when the bundle .zip is extracted.
As the installation page says, you can locate the file flutter_console.bat inside the flutter directory and you can start it by double-clicking.
the flutter console is just a batch file for this commands
REM "%~dp0" is the directory of this file including trailing backslash
"%~dp0" expands to current directory path of the running batch file.
SET PATH=%~dp0bin;%PATH%
CALL cmd /K "#echo off & cd %USERPROFILE% & echo on"
but the flutter console mentioned in the doc is not what you are running . you can find the flutter console in the flutter main folder
You can find the Flutter Console right inside the SDK folder called flutter.bat (Windows).
You can use it to run Flutter commands! But I recommend you to add the PATH variable on your Variable Environment. Then you can run Flutter commands without needs to open its console again in the future.
The flutter console is mainly used to run various flutter commands. $flutter doctor command is used to check the initial setting which is required to run the flutter application.
$flutter doctor command result