Flutter 2.0 upgrade, pub get failed with nonsense dependency behavior - flutter

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

Related

problem adding flutter_dialogflow dependency into flutter

I'm trying to make a chatbot using dialogflow in flutter and currently facing this error trying to add dialogflow dependency and i do not know how to solve it. can anyone help?
The current Dart SDK version is 2.16.2.
Because firebase_auth >=3.3.15 depends on firebase_auth_web ^3.3.13 and no versions of firebase_auth_web match >3.3.13 <4.0.0, firebase_auth >=3.3.15 requires firebase_auth_web 3.3.13.
(1) So, because firebase_auth_web 3.3.13 depends on http_parser ^4.0.0 and http >=0.11.3+17 <0.13.0-nullsafety.0 depends on http_parser >=0.0.1 <4.0.0, firebase_auth >=3.3.15 is incompatible with http >=0.11.3+17 <0.13.0-nullsafety.0. Because flutter_dialogflow <0.1.0 requires SDK version >=1.8.0 <2.0.0 and flutter_dialogflow >=0.1.0 <0.1.3 depends on http ^0.11.3+16, flutter_dialogflow <0.1.3 requires http ^0.11.3+16.
And because http >=0.2.8+2 <0.11.3+17 requires SDK version <2.0.0 and flutter_dialogflow >=0.1.3 depends on http ^0.12.0+2, every version of flutter_dialogflow requires http ^0.11.3+17 or ^0.12.0+2.
And because firebase_auth >=3.3.15 is incompatible with http >=0.11.3+17 <0.13.0-nullsafety.0 (1), firebase_auth >=3.3.15 is incompatible with flutter_dialogflow.
So, because knowyoursim_app depends on both firebase_auth ^3.3.15 and flutter_dialogflow any, version solving failed.
Running "flutter pub get" in knowyoursim_app...
pub get failed (1; So, because knowyoursim_app depends on both firebase_auth ^3.3.15 and flutter_dialogflow any, version solving failed.)
this is my dependencies
environment:
sdk: ">=2.16.2 <3.0.0"
dependencies:
flutter:
sdk: flutter
style icons.
cupertino_icons: ^1.0.2
firebase_core: ^1.15.0
firebase_auth: ^3.3.15
test: ^1.19.5
bloc: ^8.0.3
flutter_bloc: ^8.0.1
equatable: ^2.0.3
flutter_launcher_icons: ^0.9.2
search_app_bar_page: ^2.1.2
#dialog_flowtter: ^0.3.3
bubble:
intl:
flutter_dialogflow:
Hi try those steps and it might work :
1 - type '$flutter clean' on console.
2 - then run '$flutter pub get' .
3 - then '$flutter pub outdated' .
4 - after that run '$flutter pub upgrade --major-versions' that should force it to upgrade your packages .
Make sure you are installing the latest dialogflow dependencies..
dialogflow_flutter: ^1.0.0
or try using this sdk: ">=2.17.0-182.2.beta <3.0.0".

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

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.

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.

Conflict with using firebase_auth and flutter_localizations packages

The packages firebase_auth and flutter_localizations cause the following error. Is there a way to fix this?
Because firebase_auth >=0.20.1 <0.21.0-1.0.nullsafety.0 depends on firebase_auth_web ^0.3.3 and no versions of firebase_auth match >0.20.0+1 <0.20.1, firebase_auth >0.20.0+1 <0.21.0-1.0.nullsafety.0 requires firebase_auth_web ^0.3.3.
And because firebase_auth 0.20.0+1 depends on firebase_auth_web ^0.3.2+6, firebase_auth >=0.20.0+1 <0.21.0-1.0.nullsafety.0 requires firebase_auth_web ^0.3.2+6.
And because firebase_auth_web >=0.3.0-dev.1 <0.4.0-1.0.nullsafety.0 depends on intl ^0.16.1 and every version of flutter_localizations from sdk depends on intl 0.17.0, firebase_auth >=0.20.0+1 <0.21.0-1.0.nullsafety.0 is incompatible with flutter_localizations from sdk.
So, because geschenk depends on both flutter_localizations any from sdk and firebase_auth ^0.20.0+1, version solving failed.
pub get failed (1; So, because geschenk depends on both flutter_localizations any from sdk and firebase_auth ^0.20.0+1, version solving failed.)
I managed to fix this issue by adding the following lines to override the dependencies:
dependency_overrides:
intl: ^0.17.0-nullsafety.2
My dependencies now look like this:
dependencies:
flutter:
sdk: flutter
flutter_localizations:
sdk: flutter
firebase_core: ^0.7.0
firebase_auth: ^0.20.1
dependency_overrides:
intl: ^0.17.0-nullsafety.2
You can try this:
dependencies:
firebase_auth_web: 0.3.3
firebase_auth: ^0.20.1
flutter:
sdk: flutter
flutter_localizations:
sdk: flutter
intl:^0.17.0-nullsafety.2

pub get failed:version solving failed

Flutter_test depends on meta 1.1.8 and firebase_login depends on meta ^1.2.2.
firebase_login depends on flutter_test any from sdk, version solving failed.
pub get failed
pubspec.yaml
version: 1.0.0+1
environment:
sdk: ">=2.7.0 <3.0.0"
dependencies:
flutter:
sdk: flutter
firebase_auth: ^0.18.0+1
equatable: ^1.2.4
google_sign_in: ^4.5.3
meta: ^1.2.2
cupertino_icons: ^0.1.3
dev_dependencies:
flutter_test:
sdk: flutter
lint: any
You can get both by
dependencies:
meta: ^1.2.2
dependency_overrides:
meta: ^1.1.8
I have same problem with bloc:
Because every version of passcode_navigator from git depends on flutter_bloc ^7.3.3 and every version of feature_menu from path depends on flutter_bloc ^8.0.0, passcode_navigator from git is incompatible with feature_menu from path
I resolve it with adding to pubspec:
dependency_overrides:
flutter_bloc: any
Do this,
meta: ^1.1.8
And then, run this,
flutter pub get
hi there try to downgrade the version of meta to 1.1.8 i tried and it worked with me in flutter 1.20.1
I experienced a similar issue with Firebase auth and permission_handler:
# pubspec.yaml:
dependencies:
flutter:
sdk: flutter
firebase_auth: ^1.4.1
permission_handler: ^5.1.0+2
The error message (truncated):
Because permission_handler ^5.1.0 depends on permission_handler_platform_interface ^2.0.2 which depends on plugin_platform_interface ^1.0.2, permission_handler ^5.1.0 requires plugin_platform_interface ^1.0.2.
And because firebase_auth 1.4.1 depends on firebase_core_platform_interface ^4.0.1 and no versions of firebase_auth match >1.4.1 <2.0.0, permission_handler ^5.1.0 is incompatible with firebase_auth ^1.4.1.
So, because my_flutter_project depends on both firebase_auth ^1.4.1 and permission_handler ^5.1.0+2, version solving failed.
A solution that worked for me:
Update permission_handler to the latest version:
flutter pub add permission_handler
Update meta to 1.2.2
meta: ^1.2.2
also update flutter using flutter upgrade command
flutter upgrade