Can not get package from pubspec.yaml - flutter

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.

Related

Is the Flutter SDK Version defined anywhere in code?

I see that in the pubspec the Dart SDK version is specified/constrained but is there anywhere to specify the Flutter SDK version? Maybe I'm missing something obvious but coming from other tech stacks like Java/Gradle I believe normally SDK versions are explicit?
What got me thinking about this is that I'm using Codemagic and have my Flutter version at "default" but I can't even tell what that is from their docs or their build logs.
You can get that from your terminal just run flutter --version, this will print out your current flutter SDK and dart SDK versions.
flutter --version
the result should be similar to this
Flutter 3.7.0 • channel stable • https://github.com/flutter/flutter.git
Framework • revision b06b8b2710 (2 weeks ago) • 2023-01-23 16:55:55 -0800
Engine • revision b24591ed32
Tools • Dart 2.19.0 • DevTools 2.20.1
Look like it's easy to limit it like this - I just missed it in the doc.
If I say I need ^4.0.0 then I get a meaningful error:
environment:
sdk: '>=2.18.6 <3.0.0'
flutter: ^4.0.0
Running "flutter pub get" in XXXX... Resolving
dependencies... The current Flutter SDK version is 3.7.1.
Because XXXX requires Flutter SDK version >=4.0.0, version
solving failed. pub get failed command:
"/opt/homebrew/Caskroom/flutter/3.3.10/flutter/bin/cache/dart-sdk/bin/dart
__deprecated_pub --directory . get --example" pub env: { "FLUTTER_ROOT": "/opt/homebrew/Caskroom/flutter/3.3.10/flutter",
"PUB_ENVIRONMENT": "flutter_cli:get", "PUB_CACHE":
"/Users/DENNCH3/.pub-cache", } exit code: 1

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

problem with dart-sdk from within flutter

I run flutter upgrade and and I got the following message
C:\Users\lenovo\IdeaProjects\simple>flutter upgrade
Flutter is already up to date on channel stable
Flutter 2.5.3 • channel stable • https://github.com/flutter/flutter.git
Framework • revision 18116933e7 (3 weeks ago) • 2021-10-15 10:46:35 -0700
Engine • revision d3ea636dc5
Tools • Dart 2.14.4
but when I try to upgrade the packages including the riverpod which has got to the stable release today
I got the following message
The current Dart SDK version is 2.13.4.
Because simple depends on flutter_riverpod >=1.0.0 which requires SDK version >=2.14.0 <3.0.0, version solving failed.
pub get failed (1; Because simple depends on flutter_riverpod >=1.0.0 which requires SDK version >=2.14.0 <3.0.0, version solving failed.)
I when check the dart sdk in the setting of the editor I'm currently using, the dart sdk is of version 2.13.4
anyone know how to fix this issue ??
Try removing the versions, keep only the dependency names in pubspec.yaml . Then run flutter pub get. It will automatically download all compatible versions.

Visual Studio Code Flutter Cannot Update Dart SDK

Because depends on cupertino_icons >=1.0.1 which requires SDK version >=2.12.0-0 <3.0.0, version solving failed.
whenever I tried to flutter run, flutter pub get, flutter pub upgrade, I got this return in console.. I also have tried flutter update-packages it returns
Flutter is already up to date on channel stable Flutter 1.22.5 •
channel stable • https://github.com/flutter/flutter.git Framework •
revision 7891006299 (3 weeks ago) • 2020-12-10 11:54:40 -0800 Engine
• revision ae90085a84 Tools • Dart 2.10.4
How can I update Dart SDK?
you should use 1.0.0 version of cupertino in your pubspec.yaml. I think there is a problem with new version of cupertino
cupertino_icons: ^1.0.0
As of 2021-03-10 or earlier, it is no longer necessary to use cupertino_icons 1.0.0 or switch to the beta update channel (flutter channel beta). Just upgrade (flutter upgrade) and re-run flutter pub get. For details, see issue 72231.

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`