Error in setting up flutter_localizations package - flutter

I need to add flutter_localizations package to use Arabic language in my application, but when I add it in pubspec.yaml, it gives me the following error:
Because calendar_timeline >=0.6.1 depends on intl ^0.16.1 and every version of flutter_localizations from sdk depends on intl 0.17.0-nullsafety.2, calendar_timeline >=0.6.1 is incompatible with flutter_localizations from sdk.
So, because elderly_app depends on both flutter_localizations any from sdk and calendar_timeline ^0.7.0, version solving failed.
pub get failed (1; So, because elderly_app depends on both flutter_localizations any from sdk and calendar_timeline ^0.7.0, version solving failed.)
This is my pubspec.yaml:
environment:
sdk: ">=2.7.0 <3.0.0"
dependencies:
flutter:
sdk: flutter
flutter_localizations:
sdk: flutter
cupertino_icons: ^1.0.1
calendar_timeline: ^0.7.0
flutter_datetime_picker: ^1.5.0
date_picker_timeline: ^1.2.1
hijri: ^2.0.3
flutter_week_view: ^1.0.0+2
url_launcher: ^5.7.10
It works when I delete the lines under flutter_localizations like cupertino_icons and calendar_timeline

According to the above message you should decrease your calendar_timeline version to lower than 0.6.1. for example calendar_timeline: 0.6.0
and add this line to pubspec.yaml file:
dependency_overrides:
intl: ^0.16.0

Try updating all of your packages to the latest version.

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.

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

Flutter force higher package dependency version

TLDR: How to force a specific Flutter package (library) version for the entire app?
Let's suppose I have the following dependencies in my pubspec.yaml file:
dependencies:
flutter:
sdk: flutter
datetime_picker_formfield: 0.4.3
date_utils: 0.1.0+3
intl: 0.15.8
which gives me a version conflict error:
Because flutter_app depends on date_utils 0.1.0+3
which depends on intl ^0.16.0, intl ^0.16.0 is required.
but when we change intl to intl: 0.15.8 we get:
Because flutter_app depends on datetime_picker_formfield 0.4.3
which depends on intl ^0.15.8, intl ^0.15.8 is required.
How to force intl: 0.16.0 for both: datetime_picker_formfield and date_utils packages?
Use dependency_overrides to force a specific package version for the entire Flutter app.
dependency_overrides:
intl: 0.16.0
So we get:
dependencies:
flutter:
sdk: flutter
datetime_picker_formfield: 0.4.3
date_utils: 0.1.0+3
intl: 0.16.0
cupertino_icons: ^0.1.2
dependency_overrides:
intl: 0.16.0

Flutter - flutter_localizations incompatible with json_schema

I am trying to add json_schema in my pubspec.yaml but when I run flutter pub get I end up with the following errors:
The current Dart SDK version is 2.7.0.
Because sockjs_client_wrapper >=1.0.14 depends on w_common ^1.20.1 and sockjs_client_wrapper >=1.0.5 <1.0.14 depends on w_common ^1.9.0, sockjs_client_wrapper >=1.0.5 requires w_common ^1.9.0.
And because w_common >=0.2.0 <1.15.0 requires SDK version >=1.12.0 <2.0.0, sockjs_client_wrapper >=1.0.5 requires w_common ^1.15.0.
Because every version of flutter_localizations from sdk depends on intl 0.16.0 and w_common >=1.15.0 depends on intl >=0.14.0 <0.16.0, flutter_localizations from sdk is incompatible with w_common >=1.15.0.
Thus, flutter_localizations from sdk is incompatible with sockjs_client_wrapper >=1.0.5.
And because json_schema >=2.0.1 depends on w_transport ^3.2.8 which depends on sockjs_client_wrapper ^1.0.5, flutter_localizations from sdk is incompatible with json_schema >=2.0.1.
So, because esiquizz depends on both json_schema ^2.2.1 and flutter_localizations any from sdk, version solving failed.
Running "flutter pub get" in esiquizz...
pub get failed (1; So, because esiquizz depends on both json_schema ^2.2.1 and flutter_localizations any from sdk, version solving failed.)
I understand that it is a problem of versions with flutter_localisations but I don't known how to solve it. Is there a way to use both flutter_localisations and json_schema ?
flutter_localizations
json_schema
This is my pubspec.yaml:
environment:
sdk: ">=2.3.0 <3.0.0"
dependencies:
flutter:
sdk: flutter
json_schema: ^2.2.1 #<==================================
flutter_localizations: #<===============================
sdk: flutter #<=======================================
cupertino_icons: ^0.1.2
firebase_core: ^0.4.0+9
firebase_analytics: ^5.0.2
firebase_auth: ^0.14.0+5
cloud_firestore: ^0.12.9+5
firebase_crashlytics: ^0.1.0+3
cloud_functions: ^0.4.1+4
dartz: ^0.8.7
get_it: ^3.0.3
flutter_bloc: ^2.0.0
equatable: ^0.6.1
mdi: ^0.2.2
provider: ^3.1.0+1
shared_preferences: ^0.5.4+3
sembast: ^2.1.0+1
path_provider: ^1.4.0
tuple: ^1.0.3
file_picker: ^1.4.2+1
Maybe you can fix it with
dependency_overrides:
json_schema: ^2.2.1