FLUTTER: Error: No pubspec.yaml file found - flutter

mac#MACs-MacBook-Air ChatApp % flutter pub get
Error: No pubspec.yaml file found.
This command should be run from the root of your Flutter project.
mac#MACs-MacBook-Air ChatApp % flutter upgrade
Flutter is already up to date on channel stable
Flutter 2.0.4 • channel stable • https://github.com/flutter/flutter.git
Framework • revision b1395592de (5 days ago) • 2021-04-01 14:25:01 -0700
Engine • revision 2dce47073a
Tools • Dart 2.12.2
mac#MACs-MacBook-Air ChatApp % flutter clean
Error: No pubspec.yaml file found.
This command should be run from the root of your Flutter project.
mac#MACs-MacBook-Air ChatApp %

Execute the relevant commands in your project root directory. If you accidentally delete pubspec.yaml, create a new one.

Related

Upgrade Flutter version in project

I'm trying to upgrade Flutter version in my project from 2.8.0 to 3.7.0. If I got it right flutter should be using the default version installed on my machine, but it doesn't. See commands below.
flutter --version
Flutter 3.7.3 • channel stable • https://github.com/flutter/flutter.git
Framework • revision 9944297138 (4 days ago) • 2023-02-08 15:46:04 -0800
Engine • revision 248290d6d5
Tools • Dart 2.19.2 • DevTools 2.20.1
Still it tries to use previous version
flutter pub get
Running "flutter pub get" in xxx...
Resolving dependencies...
Because xxx depends on flutter >=3.0.0 which doesn't match any versions, version solving failed.
pub get failed
command: "/usr/local/Caskroom/flutter/2.8.0/flutter/bin/cache/dart-sdk/bin/dart __deprecated_pub --color
--directory . get --example"
pub env: {
"FLUTTER_ROOT": "/usr/local/Caskroom/flutter/2.8.0/flutter",
"PUB_ENVIRONMENT": "flutter_cli:get",
"PUB_CACHE": "/Users/yyy/.pub-cache",
}
exit code: 1
you could try :
flutter clean
flutter pub get
if it repeats, maybe you could:
flutter clean
flutter pub upgrade

`flutter run -d chrome` always closes the chrome after render

I'm trying to see / develop the flutter app in Web.
However, when I run:
flutter run -d chrome
It can start a chrome browser, and render the page properly; then it would just close, and the process just exit.
I'm also trying:
➜ slide_puzzle git:(release) ✗ webdev serve
webdev could not run for this project.
Could not find a file named "pubspec.yaml" in "$HOME/.pub-cache/hosted/pub.dartlang.org/_fe_analyzer_shared-47.0.0".
Here's the project I'm trying to run: <github.com/VGVentures/slide_puzzle>
I'm on Mac, running with latest flutter:
➜ slide_puzzle git:(release) ✗ flutter --version
Flutter 3.3.10 • channel stable • https://github.com/flutter/flutter.git
Framework • revision 135454af32 (2 weeks ago) • 2022-12-15 07:36:55 -0800
Engine • revision 3316dd8728
Tools • Dart 2.18.6 • DevTools 2.15.0

Flutter Problem This requires the 'control-flow-collections' experiment to be enabled

i run flutter upgrade it works correctly but then i got errors with if used with widget
error: This requires the 'control-flow-collections' experiment to be enabled
this is my flutter version after update
i run flutter --version and this was the result
Flutter 1.17.1 • channel stable • https://github.com/flutter/flutter.git
Framework • revision f7a6a7906b (9 days ago) • 2020-05-12 18:39:00 -0700
Engine • revision 6bc433c6b6
Tools • Dart 2.8.2
i need some help thank you
update your pubspec.yaml
sdk: ">=2.7.0 <3.0.0"
2.Create a file at your project root named analysis_options.yaml
3.Paste this into the newly created file
analyzer:
enable-experiment:
- spread-collections
4.Just save all and restart your editor then open terminal at your project directory and type 'flutter pub get`

flutter --flow-control-collections are needed, but are they?

After upgrading flutter (both master and stable versions) and dart, I get an error about the experiment --flow-control-collections not being enabled for various for-loops that I'm using in the project. I tried to fix it using this entry but that just made things weirder. So, now I have the below error that tells me that I need the control-flow-collections experiement to be enabled while simultaneously telling me that it's no longer required.
This error comes up for every for-loop that I'm using.
Here's my flutter --version result:
Stable:
Flutter 1.12.13+hotfix.5 • channel stable • https://github.com/flutter/flutter.git
Framework • revision 27321ebbad (13 days ago) • 2019-12-10 18:15:01 -0800
Engine • revision 2994f7e1e6
Tools • Dart 2.7.0
Master:
Flutter 1.13.6-pre.16 • channel master • https://github.com/flutter/flutter.git
Framework • revision fcaf9c4070 (2 days ago) • 2019-12-21 14:03:01 -0800
Engine • revision 33813929e3
Tools • Dart 2.8.0 (build 2.8.0-dev.0.0 886615d0f9)
Any ideas how to resolve this?
Hey, I had the same issue this morning but found a fix.
1) Keep the analysis_options.yaml in your root folder with this code:
analyzer:
enable-experiment:
- control-flow-collections
2) Don't use brackets {} in between your for loops
Ex:
<Widget>[
for (final category in categories)
CategoryWidget(category: category)
],
3) Important step which is probably why it's not working for you:
Change your Dart version constraint in the pubspec.yml file in your root folder to 2.5.2
environment:
sdk: ">=2.5.2 <3.0.0"
Change dart version in pubspec.yml
environment:
sdk: ">=2.6.0 <3.0.0"
then
flutter pub get
flutter clean
And restart Android Studio
Even after changing the dart version didn't work, then just restart your VS Code or whatever editor you're using. Then check if the error is there. If so, then run flutter clean.
I had also this issues in my project, and I resolved my issues by following this steps:
SDK: ">=2.5.2 <3.0.0"
2.Run flutter clean
3.Restart VSCode

Can not get package from pubspec.yaml

I update my flutter to latest version.
Flutter 1.7.8+hotfix.3 • channel stable • https://github.com/flutter/flutter.git
Framework • revision b712a172f9 (13 days ago) • 2019-07-09 13:14:38 -0700
Engine • revision 54ad777fd2
Tools • Dart 2.4.0
When I do a get package update, I get an error:
Package doesn't exist (the pubspec for google_maps_flutter 0.5.6 from git has version 0.5.13).
But when i update from version 0.536 to 0.5.13 and then do a package update, it show nothing.
Maybe pubspec.lock is forcing to use that version.
Try these steps:
Delete pubspec.lock file.
After that run 'Flutter clean'
Then run 'Flutter pub get'
Then run the app.
Hope it will work for you.
The last version of this package is the 0.5.19+2.
google_maps_flutter: ^0.5.19+2
Follow this instruction and it should work.