when i check dart version on cmd i got version 2.16.0(stable) but on flutter doctor i found 2.0.14 - flutter

dependencies:
flutter:
sdk: flutter
# The following adds the Cupertino Icons font to your application.
# Use with the CupertinoIcons class for iOS style icons.
cupertino_icons: ^1.0.2
sqflite: ^2.0.1
intl: ^0.17.0
bloc: ^8.0.2
flutter_bloc: ^8.0.1
conditional_builder_null_safety: ^0.0.6
dio: ^4.0.4
shared_preferences: ^2.0.5
webview_flutter: ^3.0.0
I get this error:
The current Dart SDK version is 2.13.4
Because todo depends on webview_flutter >=2.0.14 which requires SDK version >=2.14.0 <3.0.0, version solving failed.
pub get failed (1; Because todo depends on webview_flutter >=2.0.14 which requires SDK version >=2.14.0 <3.0.0, version solving failed.)

Your current dart sdk version is 2.13.4, 2.0.14 is webview_flutter version, and in error message it asks you so dart sdk version is above 2.14.
Since one of the releases( do not remember which one :(, proof is here ) Dart is bundled with flutter sdk so if you installed dart on your system separately versions might mismatch because flutter uses bundled one and in shell you see system one. try upgrading flutter sdk constraints.

Related

Every version of integration_test depends on flutter_driver any from sdk which depends on crypto 2.1.5

I've been getting an error ever since I tried adding integration_test package along with get_test and it's primarily due to the fact that just_audio depends on crypto: ^3.0.0 while integration_test depends on crypto: ^2.1.5.
I tried to look online to see if it's possible to only install dependencies without dev_dependencies however it seems like flutter pub cli tool doesn't support that yet based on this issue.
Here is my pubspec.yaml
environment:
sdk: ">=2.7.0 <3.0.0"
dependencies:
flutter:
sdk: flutter
cupertino_icons: ^1.0.2
share: ^2.0.1
get:
get_storage:
shared_preferences: ^2.0.5
audio_service: 0.17.0-nullsafety.0
just_audio: ^0.7.4
dev_dependencies:
flutter_test:
sdk: flutter
get_test: ^3.13.3
integration_test: ^1.0.2+1
test: ^1.14.4
This is the error I am getting.
Because every version of integration_test depends on flutter_driver any from sdk which depends on crypto 2.1.5, every version of integration_test requires crypto 2.1.5.
And because just_audio 0.7.4 depends on crypto ^3.0.0 and no versions of just_audio match >0.7.4 <0.8.0, integration_test is incompatible with just_audio ^0.7.4.
So, because egy_fm_radio depends on both just_audio ^0.7.4 and integration_test ^1.0.2+1, version solving failed.
pub get failed (1; So, because egy_fm_radio depends on both just_audio ^0.7.4 and integration_test ^1.0.2+1, version solving failed.)
I think this specific issue could have been be resolved by updating the Flutter SDK to the latest (>=2.2.0), but if there's anybody experiencing a similar issue, consider using Dependency overrides to override dependencies of built-in packages such as integration_test and flutter_driver.
dependency_overrides:
crypto: ^3.0.0
Note that this involves some risk and pub will show you a warning during dependency resolution.
Looking through your pubspec.yaml it appears the problem lies within the crypto dependency mismatch.
Inside your pubspec.yaml you can explictly declare the latest crypto version:
environment:
sdk: ">=2.7.0 <3.0.0"
dependencies:
flutter:
sdk: flutter
cupertino_icons: ^1.0.2
share: ^2.0.1
crypto: 3.0.1
get:
get_storage:
shared_preferences: ^2.0.5
audio_service: 0.17.0-nullsafety.0
just_audio: ^0.7.4
dev_dependencies:
flutter_test:
sdk: flutter
get_test: ^3.13.3
integration_test: ^1.0.2+1
test: ^1.14.4
What happens is that when you use so many packages, some of those packages use some other packages. It may so happen that two or more packages use the same package.So, it creates an error incase of mismatch because you cannot have two different versions of the same package.

Flutter path_provider and sdk version mismatch

The current Dart SDK version is 2.10.5.
Because path_provider 2.0.1 requires SDK version >=2.12.0-259.9.beta <3.0.0 and no versions of path_provider match >2.0.1 <3.0.0, path_provider ^2.0.1 is forbidden.
So, because harmonoid depends on path_provider ^2.0.1, version solving failed.
pub get failed (1; So, because harmonoid depends on path_provider ^2.0.1, version solving failed.)
How do i solved this error? this is my pubspec.yaml
version: 1.0.0+1
environment:
sdk: ">=2.8.0 <3.0.0"
dependencies:
flutter:
sdk: flutter
animations: ^1.1.2
provider: ^4.3.3
assets_audio_player:
git: https://github.com/alexmercerind/Flutter-AssetsAudioPlayer
media_metadata_retriever: ^0.0.2+1
http: ^0.12.2
path: ^1.7.0
path_provider: ^2.0.1
flutter_local_notifications: ^3.0.3
url_launcher: ^5.5.0
permission_handler: ^5.0.1+1
share: ^0.6.5+4
palette_generator: ^0.2.3
implicitly_animated_reorderable_list: ^0.3.2
dev_dependencies:
flutter_test:
sdk: flutter
error
My Dart SDK version is 2.12.0, and the Flutter version is 2.0.1. I created a new project and copied all your dependencies. The project worked without any problems.
For saving your time, I recommend upgrading to the stable channel and Flutter 2 using these commands or this link.
flutter channel stable
flutter upgrade
If you don't want to migrate your Flutter and Dard SDK versions yet,
I would recommend you to try and remove the version from the line:
path_provider: ^2.0.1
so it would look like this: path_provider:
run: pub get again
run your project again
Eventually I would recomment to migrate to the newest version of the SDKs and upgrade all your dependencies. This is just a temporary solution.

Flutter 2.0 upgrade, pub get failed with nonsense dependency behavior

The project was working like a charm that started issues after the upgrade to flutter 2.0. following are errors upon pub get.
[delivered] flutter pub get
Running "flutter pub get" in delivering...
Because every version of flutter_localizations from sdk depends on intl 0.17.0 and firebase_auth_web >=0.3.0-dev.1 <0.4.0-1.0.nullsafety.0 depends on intl ^0.16.1, flutter_localizations from sdk is incompatible with firebase_auth_web >=0.3.0-dev.1 <0.4.0-1.0.nullsafety.0.
Because firebase_auth >=0.18.4 <=0.18.4 depends on firebase_auth_web ^0.3.2+2 and firebase_auth ^0.18.4+1 depends on firebase_auth_web ^0.3.2+3, firebase_auth ^0.18.4 requires firebase_auth_web ^0.3.2+2.
Thus, flutter_localizations from SDK are incompatible with firebase_auth ^0.18.4.
So, because iDelivered depends on both flutter_localizations any from SDK and firebase_auth ^0.18.4, version solving failed.
pub get failed (1; So, because delivered depends on both flutter_localizations any from SDK and firebase_auth ^0.18.4, version solving failed.)
exit code 1
Here is my pubspec.yaml for reference:
version: 1.0.0+1
environment:
sdk: ">=2.7.0 <3.0.0"
dependencies:
flutter:
sdk: flutter
flutter_localizations:
sdk: flutter
google_fonts: ^1.1.1
http: ^0.12.2
shared_preferences: ^0.5.12+4
firebase_core: ^0.5.3
firebase_auth: ^0.18.4
cloud_firestore: ^0.14.4
firebase_messaging: ^7.0.3
parse_server_sdk_flutter: ^2.1.0
place_picker: ^0.9.16
google_maps_flutter: ^1.0.6
animations: ^1.1.2
flutter_slidable: ^0.5.7
My suggestion is for a few week don't update your flutter version
To downgrade your flutter (Master channel):
flutter downgrade 1.22.6
Since you upgraded to Flutter 2.0, the flutter sdk is the source of the flutter_localizations. So, you have to upgrade your firebase dependencies e.g. firebase_auth, firebase_core to at least version 1.0.0.
My advice is that if the packages you are using have not been upgraded to null-safety OR they have not been recently updated, you should just stick to the 1.22.6 stable version of flutter for now.
You can try to add dependency_overrides to resolve this conflicts :
dependency_overrides:
intl: "<0.17.0"
Downgrade flutter using flutter downgrade version
my solution for this issue..
download both 2.0.2 flutter SDK and 1.22.6 flutter SDK. change flutter SDK project-wise.
In my app,
I upgrade following three pubs to latest
firebase_analytics: ^7.1.1,
firebase_core: ^1.0.1,
firebase_messaging: ^9.0.0
I downgrade google mobile ads SDK to 7.6.9 in IOS pod file, it works for me. https://github.com/FirebaseExtended/flutterfire/issues/4931

Flutter theme version solving failed

I am trying to run a flutter theme code in visual studio code and facing this issue after running command (flutter run)
Because every version of flutter_test from sdk depends on vector_math 2.1.0-nullsafety.5 and fstore depends on vector_math 2.0.8, flutter_test from sdk is forbidden.
So, because fstore depends on flutter_test any from sdk, version solving failed.
Running "flutter pub get" in ecomputex...
pub get failed (1; So, because fstore depends on flutter_test any from sdk, version solving failed.)
Please helpenter image description here
just add this line of code in your pubspec
dependency_overrides:
vector_math: 2.1.0-nullsafety.5
this will override the dependency, and you can use whatever version you want. you might need to change it the version of the package.
my code example:
dependencies:
flutter:
sdk: flutter
cupertino_icons: ^1.0.0
file_picker: ^3.0.0
hive: ^2.0.0
hive_flutter: ^1.0.0
dependency_overrides:
path_provider: 2.0.1

charts_flutter ^0.6.0 version solving failed

While updating charts_flutter from 0.5.0
Logs
[myapp] flutter packages get
Running "flutter packages get" in myapp...
The current Dart SDK version is 2.1.0-dev.9.4.flutter-f9ebf21297.
Because charts_flutter >=0.6.0 depends on charts_common >=0.6.0 which requires SDK version >=2.1.0 <3.0.0, charts_flutter >=0.6.0 is forbidden.
So, because myapp depends on charts_flutter ^0.6.0, version solving failed.
pub get failed (1)
exit code 1
pubspec
environment:
sdk: ">=2.0.0-dev.68.0 <3.0.0"
dependencies:
flutter:
sdk: flutter
# The following adds the Cupertino Icons font to your application.
# Use with the CupertinoIcons class for iOS style icons.
cupertino_icons: ^0.1.2
charts_flutter: ^0.6.0
Things I've already tried
flutter clean
flutter update-packages
The current Dart SDK version is 2.1.0-dev.9.4.flutter-f9ebf21297.
...
which requires SDK version >=2.1.0 <3.0.0
2.1.0-... is < than 2.1.0
For charts_flutter: ^0.6.0 you need a newer Flutter version.
Try
flutter channel dev
flutter doctor
flutter packages get