Adding widget to flutter app causes conflicts in .yaml file - flutter

I am trying to add a calendar widget to my flutter app but I am getting errors when I run "pub get".
pubspec.yaml content:
environment:
sdk: ">=2.8.0 <3.0.0"
dependencies:
flutter:
sdk: flutter
cupertino_icons: ^0.1.2
animated_text_kit: ^1.3.0
firebase_core: ^0.5.2+1
firebase_auth: ^0.18.4+1
firebase_auth_web: ^0.3.2+3
cloud_firestore: ^0.14.3+1
modal_progress_hud: ^0.1.3
uuid: ^2.2.2
provider: ^4.3.2+3
flutter_launcher_icons: ^0.8.1
flutter_keyboard_visibility: ^4.0.2
firebase_messaging: ^7.0.3
table_calendar: ^3.0.0
intl: ^0.17.0
Output from pub get:
Running "flutter pub get" in tonnah...
Because tonnah depends on firebase_auth_web ^0.3.2+3 which depends on intl ^0.16.1, intl ^0.16.1 is required.
So, because tonnah depends on intl ^0.17.0, version solving failed.
pub get failed (1; So, because tonnah depends on intl ^0.17.0, version solving failed.)
Process finished with exit code 1
When I change the intl: ^0.17.0 to intl:^0.16.1 I get the following output from pub get:
Running "flutter pub get" in tonnah...
Because tonnah depends on table_calendar ^3.0.0 which depends on intl ^0.17.0, intl ^0.17.0 is required.
So, because tonnah depends on intl ^0.16.1, version solving failed.
pub get failed (1; So, because tonnah depends on intl ^0.16.1, version solving failed.)
Process finished with exit code 1
I seem to be running in circles. How do I fix this?

Add this to your pubspec.yaml:
dependency_overrides:
intl: ^0.16.1

Related

flutter packages get command gives an error error

hello I tried running flutter pub get and I was faced with this error:
flutter pub get
Waiting for another flutter command to release the startup lock...
Running "flutter pub get" in Deutsche-Flutter...
Because every version of flutter_test from sdk depends on test_api 0.3.0 and mockito 4.1.4 depends on test_api ^0.2.19-nullsafety, flutter_test from sdk is incompatible with mockito 4.1.4.
And because no versions of mockito match >4.1.4 <5.0.0, flutter_test from sdk is incompatible with mockito ^4.1.4.
So, because deutsche depends on both mockito ^4.1.4 and flutter_test any from sdk, version solving failed.
pub get failed (1; So, because deutsche depends on both mockito ^4.1.4 and flutter_test any from sdk, version solving failed.)
exit code 1
I already ran flutter upgrade and tried to run flutter pub get here are my dependencies:
environment:
sdk: ">=2.7.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: ^1.0.0
flutter_svg: ^0.19.1
flutter_bloc: ^6.1.2
get: ^3.23.1
rxdart: ^0.19.0
http: ^0.12.2
google_fonts: ^0.3.9
circular_countdown_timer: ^0.1.0
pin_code_fields: ^2.4.0
google_nav_bar: ^3.2.0
line_icons: ^0.2.0
shared_preferences: ^0.5.12+4
flutter_launcher_icons: ^0.7.2+1
rive: ^0.6.8
timer_count_down: ^1.0.4+1
logger: ^0.9.4
dartz: ^0.9.0-dev.6
freezed_annotation: ^0.12.0
bloc_test: ^7.1.0
mockito: ^4.1.4
jwt_decode: ^0.3.1
carousel_slider: ^3.0.0
dev_dependencies:
build_runner:
freezed: ^0.12.7
flutter_test:
sdk: flutter
Update all of your plugins and that will work. And do make sure that all of them are null-safety enabled.
try replacing mokito version as any as follows.
mockito: any
then check the pubspeck.lock file and search mokito and take that version number from there and replace it in pubspec.yaml file
update the mockito package to => mockito: ^5.2.0

Flutter - v 1.24.0 to 2.0.5 - pubspec.yaml version problems

I have downloaded flutter_windows_2.0.5-stable.zip and installed Flutter 2.0.5.
When I run a v1.24.0 project, I get the following output:
Running "flutter pub get" in get_json ...
The current Dart SDK version is 2.12.0-29.10.beta.
Because flutter_easyloading 3.0.0 requires SDK version >=2.12.0 <3.0.0 and no versions of flutter_easyloading match >3.0.0 <4.0.0, flutter_easyloading ^3.0.0 is forbidden.
So, because get_json depends on flutter_easyloading ^3.0.0, version solving failed.
pub get failed (1; So, because get_json depends on flutter_easyloading ^3.0.0, version solving failed.)
Contents of pubspec.yaml:
dependencies:
flutter:
sdk: flutter
http: ^0.12.2
json_annotation: ^2.0.0 #^4.0.1
rflutter_alert: ^1.1.0 #^2.0.2
pdf_flutter: ^1.1.4
syncfusion_flutter_pdfviewer: ^18.4.49-beta
webview_flutter: ^1.0.7 #^2.0.4
flutter_easyloading: ^3.0.0
cupertino_icons: ^1.0.1
dev_dependencies:
flutter_test:
sdk: flutter
build_runner: ^1.0.0
json_serializable: ^2.0.0 #^4.1.1
Looking around the Internet I found
Update to/install latest Flutter packages (pubspec.yaml)
At the end of this it is stated that in Flutter 2 it will help to run
1 flutter pub outdated and
2 flutter pub upgrade --major-versions
Running 1 "flutter pub outdated" gives a looot of output and ends with:
Changed 75 dependencies!
25 packages have newer versions incompatible with dependency constraints.
Try `flutter pub outdated` for more information.
No changes to pubspec.yaml!
Running 2 "flutter pub upgrade --major-versions" also gives a lot of output and ends with:
...
No dependencies changed.
25 packages have newer versions incompatible with dependency constraints.
Try `flutter pub outdated` for more information.
Changed 4 constraints in pubspec.yaml:
json_annotation: ^2.0.0 -> ^4.0.1
rflutter_alert: ^1.1.0 -> ^2.0.2
webview_flutter: ^1.0.7 -> ^2.0.4
json_serializable: ^2.0.0 -> ^4.1.1
pubspec.yaml was changed to:
dependencies:
flutter:
sdk: flutter
http: ^0.12.2
json_annotation: ^4.0.1 #^4.0.1
rflutter_alert: ^2.0.2 #^2.0.2
pdf_flutter: ^1.1.4
syncfusion_flutter_pdfviewer: ^18.4.49-beta
webview_flutter: ^2.0.4 #^2.0.4
flutter_easyloading: ^3.0.0
cupertino_icons: ^1.0.1
dev_dependencies:
flutter_test:
sdk: flutter
build_runner: ^1.0.0
json_serializable: ^4.1.1 #^4.1.1
Now I try run my (old) project again which results in the following output:
Running "flutter pub get" in get_json...
The current Dart SDK version is 2.12.0-29.10.beta.
Because no versions of json_serializable match >4.1.1 <5.0.0 and json_serializable 4.1.1 requires SDK version >=2.12.0 <3.0.0, json_serializable ^4.1.1 is forbidden.
So, because get_json depends on json_serializable ^4.1.1, version solving failed.
pub get failed (1; So, because get_json depends on json_serializable ^4.1.1, version solving failed.)
I have tried many variations of what is described above, but I am stuck.
Can anyone help or guide me in the right direction? Thank you.
==============================
Thank you to Ujjwal Raijada. I got Flutter 2 because of web support and did not think of null safety. However, I have now followed the migration guide to the detail and now have the following pubspec.yaml:
environment:
sdk: '>=2.12.0 <3.0.0'
dependencies:
flutter:
sdk: flutter
http: ^0.13.1
json_annotation: ^4.0.1
rflutter_alert: ^2.0.2
#pdf_flutter: ^1.1.4 # Package pdf_flutter is not null safe and therefore cannot be used ...
syncfusion_flutter_pdfviewer: ^19.1.57-beta
webview_flutter: ^2.0.4
flutter_easyloading: ^3.0.0
cupertino_icons: ^1.0.2
dev_dependencies:
flutter_test:
sdk: flutter
build_runner: ^2.0.1
json_serializable: ^4.1.1
I have also changed my code as suggested by the migration guide. so now I run "flutter packages pub run build_runner build" which results in:
The pubspec.yaml file has changed since the pubspec.lock file was generated, please run "pub get" again.
pub finished with exit code 65
Pressing "pub get" in pubspec.yaml gives the following result:
The current Dart SDK version is 2.12.0-29.10.beta.
Because get_json requires SDK version >=2.12.0 <3.0.0, version solving failed.
pub get failed (1; Because get_json requires SDK version >=2.12.0 <3.0.0, version solving failed.)
Process finished with exit code 1
What should I do now? Any help out there? Thank you.

Flutter - pub get error, when getting versions of path_provider

I'm migrating from flutter 1 to flutter 2, and when I updated my packages from pubspec.yaml, I received this error:
Because path_provider >=1.6.4 <2.0.0-nullsafety depends on path_provider_platform_interface ^1.0.1 which depends on plugin_platform_interface ^1.0.1, path_provider >=1.6.4 <2.0.0-nullsafety requires plugin_platform_interface ^1.0.1.
And because firebase_messaging >=9.0.0 depends on firebase_core_platform_interface ^4.0.0 which depends on plugin_platform_interface ^2.0.0, path_provider >=1.6.4 <2.0.0-nullsafety is incompatible with firebase_messaging >=9.0.0.
So, because myApp depends on both firebase_messaging ^9.1.1 and path_provider ^1.6.5, version solving failed.
Running "flutter pub get" in myApp...
pub get failed (1; So, because myApp depends on both firebase_messaging ^9.1.1 and path_provider
^1.6.5, version solving failed.)
My pubspec.yaml archive:
version: 1.0.0+1
environment:
sdk: ">=2.2.2-dev.68.0 <3.0.0"
dependencies:
flutter:
sdk: flutter
flutter_localizations:
sdk: flutter
cupertino_icons: ^0.1.3
path_provider: ^1.6.5
dev_dependencies:
flutter_test:
sdk: flutter
flutter:
uses-material-design: true
You should try out with null safety
path_provider:
without version.

Error in setting up flutter_localizations package

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.

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