Flutter does not working even after Path update - flutter

I tried to install flutter, i followed excat steps in official docs. Installed SDK from github and added path to my bashrc file, As shown below picture, even though path successfully updated, flutter commands not recognizing and not working.
https://imgur.com/a/WfQ88J0

1
I recommend clearing the android-studio-dir and android-sdk settings, and let flutter automatically detects their path instead: This works for me .
flutter config --android-studio-dir=""
flutter config --android-sdk=""

Related

How come "flutter create ." adds desktop support?

I created a Flutter project within Android Studio, and then later found out that Flutter supports desktop. After searching the web, I did things like switching to "dev", adding config for desktop, etc. But when I tried to ran it, I got "No Windows desktop project configured", even though I enabled the configuration.
The documentation page had
To add desktop support to an existing Flutter project, run the following command in a terminal from the root project directory:
flutter create .
This adds the necessary desktop files and directories to your existing Flutter project.
But what is the meaning of .? How come that . means "adding desktop support"?
The command to add desktop support are those one:
flutter config --enable-windows-desktop
flutter config --enable-macos-desktop
flutter config --enable-linux-desktop
Once you used them, you change your flutter config.
Then, the usage of flutter create . simply mean "Create a new flutter project in my current folder".
If you're already in a Flutter project, it will just "recreate" your project by adding the new support for Desktop since you specify in your flutter config.
flutter config --enable-[windows,linux,macos]-desktop
flutter create .
if there is some error with second command, remove - sign from parent folder name, and run this command:
flutter create --org com.example.myapp .
Run this command it works fine for me.
run
flutter config --enable-windows-desktop
then run
flutter create .
if flutter create . generate error, probably there is - in your root project directory.
for example it will generate error if your project is like below
Alewa-Stock
to work it fine rename your project directory like below
alewa_stock
then run the following command
flutter create --platforms=windows --org=com.alewa.store .
*
NB: Please change the name according to your preference.
flutter create --platforms=windows,macos,linux .
you can use this line instead

How do you run the official flutter animations example package

I am trying to run the examples shown on the official animations plugin page for flutter here
https://pub.dev/packages/animations
The instructions are seemingly simple but I can’t seem to do it. It says
“ To see examples of the following animations on a device or simulator:
cd example/
flutter run --release# “
My question is how do you do the above instruction exactly?
I tried creating a new Flutter project and tried cd example/ assuming it was hidden file.
I also tried looking for a url to clone the git repo but found nothing...
In short how do I get those examples on the animations as a flutter project and run them?
the example folder is not hidden, it is the folder of your project you should cd 'your flutter project path here' and then run the command run --release.
you will get the starter boilerplate for a flutter project, if you want the actual examples you should check the examples tab and copy what's in there in your main.dart file
also if you want the link to the github repo press on the link in blue that says example/lib/main.dart.

Where does `pub get` download pubspec dependencies to?

In javascript, we have NPM and the node_modules folder in every project. I was not able to find a similar concept for Dart/ Flutter, except the build folder in my app, which contains a folder of a few dependencies I have in pubspec.yaml. It doesn't have any of the source code though, and I think it's actually built from something else. I've also looked in /usr/local/flutter/packages which is where my flutter is installed, but it only shows flutter_driver, flutter_goldens, and more seemingly unrelated folders.
I guess if wanted to read the source code, I really need to find the repo and read from that, or is there a location for dependencies I haven't looked?
I even found projectDir/.dart_tool/pub, which didn't have any of my packages.
From the documentation:
Dependencies downloaded over the internet, such as those from Git and
the pub.dev site, are stored in a system-wide cache. This means that
if multiple packages use the same version of the same dependency, it
only needs to be downloaded and stored locally once.
By default, the system package cache is located in the .pub-cache
subdirectory of your home directory (on Mac and Linux), or in
%APPDATA%\Pub\Cache (on Windows; the location might vary depending on
the Windows version). You can configure the location of the cache by
setting the PUB_CACHE environment variable before running pub.
So for Mac and Linux for example, this would be ~/.pub-cache/hosted/pub.dartlang.org by default.
In Android Studio
I could directly view the source code of the package under `
[External Libraries/Dart Packages/Your Packages]
`
You can get pubspec downloaded from your flutter sdk location .
/flutter/.pub-cache/hosted/pub.dartlang.org/
You can also clone package git .
If you are running Windows as your OS, you can find the packages under the folder that you installed your Flutter SDK to when setting up Android Studio.
In my case - using Windows 10 - the path is as follows, where C:\ is my primary harddrive and flutter\ the folder containing the Flutter SDK...
C:\flutter\.pub-cache\hosted\pub.dartlang.org\english_words-4.0.0
The above path for instance points to the "english words package", containing the most ~5000 used English words and some utility functions, which are mentioned and used in the Flutter tutorial on their official page for writing and running your first Flutter app.
https://pub.dev/packages/english_words
If you have installed flutter using snap then the location might be
/home/user/snap/flutter/common/flutter/.pub-cache/hosted/pub.dartlang.org
I had forgotten that I've been command + clicking into these libraries all the time in VSCode.
However, it looks like packages are not stored in the app folder. Packages that we use in our projects are downloaded to $FLUTTER_PATH/.pub-cache, so if I'm looking for camera picker plugin, its in
/usr/local/flutter/.pub-cache/hosted/pub.dartlang.org/image_picker-0.6.5+2/lib/image_picker.dart
If you are using VScode you can find these dependencies under the dependencies window:

I have some errors in flutter installation

I need some help in solving this problem in flutter installation
i Installed flutter put when running flutter doctor show an error
./flutter/bin/flutter: line 46: /c/src/flutter/flutter/bin/cache/dart-sdk/bin/pub: No such file or directory
Error: Unable to 'pub upgrade' flutter tool. Retrying in five seconds... (8 tries left)
Go inside flutter SDK
you have to delete the cache folder inside bin and it will help you.
Thanks!
I dont know whether u downloaded git or not, cloned it or not
so I recommend u to follow step by step as directed on this site-
https://flutter.dev/docs/get-started/install/windows
and the question u asked can be solved if u copy the location of flutter.bin which is located in flutter directory after cloning git, and set path of that particular files in environment variables.
you can find environment variables on right clicking on this pc icon >properties>advanced system setting>environment variables>click on path if dont have create a new path,if having select it >edit >and paste location there.
run flutter doctor.
that's it.
in my case, when I cancel the flutter upgrade in the middle of using an Android Studio then the flutter becomes unreadable again, then when I when the flutter in the terminal will be like this:
... flutter/bin/cache/dart-sdk/bin/dart: No such file or directory
then the solution is quite easy.
go to where the directory folder is / flutter / bin / cache /
Delete the dart-sdk folder
rename the dart-sdk.old folder to dart-sdk only
finished, your flutter is working again.

New Flutter projects results in a blank project

This type of steps follws for flutter setup :
1)download latest version of v1.7.8+hotfix.4 this below link
https://flutter.dev/docs/development/tools/sdk/releases
2)my flutter store in this url : C:\src
3)set enviroment variable C:\src\flutter\bin
4)Android studio download and install.
5)install plugin flutter & dart...in android studio...than after restart IDE.
6) than after i have to start a new flutter project
-flutter_demo (project name)
-C:\src\flutter (SDK path)
-C:\src\flutter_project (project location)
my issue is this when i have to create new flutter project only create blank folder in this location [[C:\src\flutter_project]] no any other process.
what is my issue??? i need to help???
this step follow another PC in window 7
--work properly
-but in my pc not working.
-my pc os is also window 7
I also faced with the same problem about creating flutter blank project. In my case, I check the installation steps and all are correct.
The answer is in User Environment Variable Path, there is also old flutter/bin path that I had tested before.
I deleted the old flutter bin path and also in System Environment Variable Path. Then, I can create flutter project and run futter doctor successfully.