What is the Flutter Console? - flutter

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

Related

Flutter doctor shows nothing even added to the path

I downloaded flutter and added to the path in my windows 10 laptop. when I run flutter doctor in cmd nothing happens for a long time
You should Restart your Window (Machine) and then go to flutter folder when you installed it and just open flutter_console.bat file and type below commands
flutter upgrade
flutter doctor
hope it helps to you
If you wish to run Flutter commands in the regular Windows console, take these steps to add Flutter to the PATH environment variable:
*From the Start search bar, enter ‘env’ and select Edit environment variables for your account.
*Under User variables check if there is an entry called Path:
-If the entry exists, append the full path to flutter\bin using ; as a separator from existing values.
- If the entry doesn’t exist, create a new user variable named Path with the full path to flutter\bin as its value.
you can read more
here

How to fix the path of flutter dart?

I try to reinstall my flutter folder, I download flutter in there website and replace the old one on the folder, but when I run flutter in terminal I get this error
fee#Mac-mini ~ % flutter
/Users/fee/Documents/flutter/bin/internal/shared.sh: line 228:
/Users/fee/Documents/flutter/bin/cache/dart-sdk/bin/dart: No such file or directory
and I cant run even flutter doctor or flutter clean can some one help me thank you
im using mac
These links will help you -
Video
Official docs - https://flutter.dev/docs/get-started/install/macos
You have to update your path variable for flutter. At first, you need to know which shell you are using by typing echo $SHELL in your terminal. Depending on your shell, edit .bashrc, .bash_profile or .zshrc by any editor. Then you have to add below code to your shell:
export PATH="$PATH:/Users/fee/Documents/flutter/bin"
Then, type source .bashrc or source .bash_profile which you have updated earlier or logout and login back to take effect your new changes.
Check your update by typing which flutter or flutter doctor in terminal.
Try it like this.
Delete the cache folder under flutter/bin

flutter doctor is running only in the installed bin directory

flutter doctor was running just fine all these times i have worked on it. I was able to create a project but was not able to run it. flutter run literally didn't do anything on my cmd.
So I wanted to make sure everything is fine by running flutter doctor, but it showed 'flutter' is not recognized as an internal or external command, operable program or batch file.
I have added the flutter\bin and the Windows\Systems32 path to my environment variables, but it still dosen't work.
Although, flutter commands work just fine on the installed flutter\bin directory.
Edit:
Try to add flutter\bin in PATH of user variables.
This is the way i configured flutter and everything is working fine.
Upgrading flutter and substituting the ; for a \ in the environment path did the job for me.

Flutter commands not showing anything

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.

Flutter doctor hangs on start, no output

I'm trying to install Flutter on my Windows 8 computer. I unzipped files to C:/flutter and added the bin folder to the path variable. However I am stuck on the step where I have to run flutter doctor in flutter_console. The Flutter doctor hangs and only shows the blinking cursor and no output. More interestingly any other flutter command will freeze the exact same way.
I have already tried
Running flutter console as admin
Reinstalling flutter
Installing the dev version
Use the VS code plugin to run flutter doctor
But they all led to the same result
So the solution of this issue is:
delete folder in your flutter SDK path flutter/bin/cache (detail info here)
run flutter doctor -v again will trigger downloading Dart SDK
PS: if your network is slow because of in china, check bellow:
Do things bellow in terminal maybe speed up your the download speed (for me it's speed up 3x) for changing channel:
export FLUTTER_STORAGE_BASE_URL=https://storage.flutter-io.cn (detail info here)
flutter channel stable (one example of change flutter channel)
flutter doctor -v (trigger downloading SDK)
Albeith in win10, these steps solved the issue for me (do not know if all are necessary)
restart win
run cmd as administrator
flutter doctor
According to this git issue, this is mostly caused by installing flutter in a directory for which you do not own the priviledges. For example, the Program Files folder: to solve then, you can try to move the installation folder
Problem
I had the same problem while trying to reinstall flutter using the recommended windows install guide found here https://docs.flutter.dev/get-started/install/windows
(flutter_windows_3.3.9-stable).
All flutter commands would hang and only show the flashing cursor. It did not matter if I was in the flutter console, PowerShell, VS Code terminal or Admin Command prompt.
This made running flutter doctor impossible, and thus I couldn't complete the flutter setup.
Environment
I am using a PC running Windows 10.
I am located in North America. (If you are in China, you may need to use a proxy server for the initial download).
Flutter was installed on a drive with ample free space in a non-restricted folder.
I have a stable internet connection.
I have git for windows installed and have set up my ssh keys. (you can download and install this form here https://git-scm.com/download/win).
I have my Windows Firewall and network protection on. (You may need to turn off third party firewalls or add a rule to them allowing flutter to make connections to the internet during the flutter setup).
Solution
This solution worked for me and should resolve most install problems related to installing flutter on a Windows environment.
Please upvote if it works for you.
Step 0 - Remove flutter from system:
If reinstalling flutter, do this step, otherwise move to step 1 if preforming a fresh installation.
Open file explorer and delete the folder titled flutter if already installed.
Type environment variables into the windows search bar and open Edit the system environment variables.
Click environment variables in the Advanced tab.
Double-click the word Path found under User variables for {YOUR USER NAME}.
Select any entries that end with \flutter or \flutter\bin and delete them.
Click the Ok button and then the Ok button to apply the changes.
Step 1 - Download Stable Flutter Version:
Go to the official flutter website https://docs.flutter.dev/development/tools/sdk/releases and download the most recent flutter version in the Stable channel (Windows).
Once downloaded, unzip the folder.
Place the flutter folder found inside the Zip file wherever you would like to store it on your computer. Flutter recommend putting it in C:\src\flutter. You can place it where've you like as long as It's not in a folder that requires elevated privileges to access, such as the C:\Program Files\ folder.
Note* I used Windows Explorer to unzip the file, however others report used 7-Zip file Manager for unzipping solved their problem.
Step 2 - Setup Environment Variables:
Type environment variables into the windows search bar and open Edit the system environment variables.
Click environment variables in the Advanced tab.
Double-click the word Path found under User variables for {YOUR USER_NAME}.
Click Browse... and navigate to where you placed the flutter folder. Then navigate to the bin file inside the flutter folder and click ok.
A new environment variable should have been added that looks like C:\src\flutter\bin.
You also need to make sure Git\bin\cmd, Git\bin\git.exe and, C:\Windows\System32\WindowsPowerShell\v1.0\ system environment paths are setup. These were post likely configured during your git for windows install.
Follow the "Update your path section" found here https://docs.flutter.dev/get-started/install/windows if this doesn't work for you.
Note* If Path doesn't exist, click new... and set variable name to Path and Variable value to the file path of your bin folder found in the flutter folder you just unzipped.
Step 3 - Reboot your computer in Safe Mode with Networking:
Press the Windows key + I on the keyboard to open Settings, or type settings in the windows search bar.
Click Update & Security and on the left pane select Recovery.
Under Advanced Startup, click Restart Now.
After the computer restarts, on the Choose an Option screen, select Troubleshoot > Advanced Options > Startup Settings > Restart.
After the computer restarts, a list of options appears. Select 5 or F5 for Safe Mode with Networking or whatever key your computer says to boot into Safe Mode with Networking.
Step 4 - Launch Administrator Command Prompt:
After rebooting, type command prompt into the windows search bar.
Right-click the application icon and click Run as administartor.
Run the following commands, flutter pub cache repair then flutter doctor -v. This might take quite some time if you have poor internet, as it will re-downloads every package in the cache.
If flutter doctor reports any red or yellow warnings with your environment, you need to resolve these first before continuing. These are quite common, and a Google search of the error or warning should solve your problem.
Note* if the command flutter is unrecognized, this means you didn't set up your environment path variables in step 2 correctly.
Step 5 - Reboot and run your project
Now that flutter doctor has run in safe mode, we can restart the computer and get out of safe mode.
Open your flutter project in Visual Studio Code.
Open a terminal window under terminal > new Terminal.
run the command, git config --global --add safe.directory C:/src/flutter make sure you use forward / and set the file path to wherever you saved your flutter folder. This can also be run from the administrator command prompt if you don't have VS Code or a flutter project.
Then run flutter doctor -v in the VS Code terminal to make sure everything is working.
Now we need to rebuild all of our packages and dependencies, run the following list of commands in order.
flutter clean
flutter pub cache repair
flutter pub get
flutter pub upgrade --major-versions
Troubleshooting
These are other solutions I noticed on stack overflow while trying to solve the problem for myself. These didn't work for my situation, but may help you solve yours.
Flutter doctor, running very slowly. Try deleting the cache folder found in, C:\src\flutter\bin\cache\ then running flutter doctor -v again. Flutter doctor hangs on start, no output
If you are in China. Download flutter through a mirror site.
Try installing a different type of unzip program (like 7-zip).
Make sure you are using the Stable flutter channel.
Make sure your path variables are set up correctly.
getting error "Waiting for another flutter command to release the startup lock" Use task manager to forcibly close any flutter or dart programs.
Can't delete old flutter folder, in use for some reason. Restart and immediately delete the folder.
Make sure flutter isn't installed in a folder that requires admin privileges to access, such as C:\Program Files\.
Make sure you have git for windows installed and have set up your ssh keys.
Add the Flutter and Dart extensions to VS Code.
Add the flutter and Dart plugins to Android Studio.
Delete the cache folder inside bin folder of the flutter sdk then run flutter doctor it should work now.