Because project depends on flutter_localizations any from sdk which depends on intl 0.16.1, intl 0.16.1 is required - flutter

Okay so i have built an app nearly a year and half ago for my company, my boss recently wanted me to add a new screen to it and i did using all old and deprecated code of firebase and everything else (i really really dont wanna update them because i know everything nearly changed and building a whole new app would be better than editing this lol, so i'm trying to avoid that option), the app runs on Android just fine, but it doesnt build on ios and it does not allow me do "flutter build ios" in the terminal giving above error when trying to build ios or trying to pub Get.
Granted my intl version was ^0.16.1 , then it would say that it requires 0.17.0 , then I changed it based on another post here to intl: ^0.17.0-nullsafety.2 but it gives the output above. what's the problem?
Here is my Pubspec.yaml:
name: tamatafreshiq
description: A new Flutter application.
# The following line prevents the package from being accidentally published to
# pub.dev using `pub publish`. This is preferred for private packages.
publish_to: 'none' # Remove this line if you wish to publish to pub.dev
version: 1.0.0+1
environment:
sdk: ">=2.7.0 <3.0.0"
dependencies:
flutter:
sdk: flutter
flutter_localizations:
sdk: flutter
cloud_firestore: ^0.14.0+2
firebase_core: ^0.5.0
shared_preferences: ^0.5.7+2
firebase_messaging: ^7.0.0
cupertino_icons: ^0.1.2
http: ^0.12.0+2
flutter_spinkit: ^3.1.0
english_words: ^3.1.5
firebase_auth: ^0.18.0+1
provider: ^4.1.3
firebase_storage: ^4.0.0
image_picker: ^0.6.7+2
image_cropper: ^1.2.3
url_launcher: ^5.4.11
localization: ^0.1.0
cached_network_image: ^2.2.0+1
fluttertoast: ^6.0.1
badges: ^1.1.3
data_connection_checker: ^0.3.4
intl: ^0.17.0-nullsafety.2
dev_dependencies:
flutter_test:
sdk: flutter
flutter:
uses-material-design: true
assets:
- assets/images/
- assets/gifs/
- assets/languages/
fonts:
- family: Rabar
fonts:
- asset: assets/fonts/Rabar_014.ttf
- family: Rubik
fonts:
- asset: assets/fonts/Rubik-Light.ttf

You need to upgrade your flutter version on your local machine to flutter 2.0+ now cause you are importing null safety supported dependency which uses dart sdk 2.12.0 but you have 2.7.0 which is making conflict with the other dependencies. If you do have 2.0+ already then upgrade the sdk of your app from pubspec.yaml. You will then have to update your code to full sound null safety starting from upgrading all the dependencies then the code, its not that hard even if your app is using firebase I get my apps upgraded to null safety within a week. Once all gets sorts out you'll have no trouble with your project in importing some null safety dependency or some else more importantly you will be able to have better performance of your app and can keep all the dependencies to support latest versions and might possible you app will be android 12 ready too

Related

Could not find package flutter_localization in the Flutter SDK

I am currently trying to implement localization in my Flutter App but whenever I try to add the dependency for flutter_localization, I get the following error Message:
Because the timer depends on flutter_localization from SDK which doesn't exist (could not find package flutter_localization in the Flutter SDK), version solving failed.
I have also correctly added the path to both my flutter and dart SDKs in Android Studio.
Here is my pubspec.yaml file:
publish_to: 'none' # Remove this line if you wish to publish to pub.dev
version: 1.0.0+1
environment:
sdk: '>=2.18.2 <3.0.0'
dependencies:
flutter:
sdk: flutter
intl: ^0.17.0-nullsafety.2
cupertino_icons: ^1.0.2
sqflite: any
shared_preferences: ^2.0.15
path_provider: any
flutter_localization:
sdk: flutter
flutter_cupertino_localizations: ^1.0.1
dev_dependencies:
flutter_test:
sdk: flutter
flutter_lints: ^2.0.0
flutter:
uses-material-design: true
I can't access GlobalMaterialLocalizations without flutter_localization and apparently, this is the easiest solution. I have already tried many solutions like checking version compatibilities and updating all dependencies. can you guys help me out?
Thanks in Advance!
Upgrading SDKs, Upgrading Dependencies, reinstalling flutter and Dart, and more
You misspelled the package
Replace
flutter_localization:
sdk: flutter
With
flutter_localizations:
sdk: flutter
Take note on the s on flutter_localizations

Flutter build error: Dart 2.13.1 is incompatible with your dependencies' SDK constraints

I am relatively new to Flutter, and don't seem to be able to figure this out.
Here is my pubspec.yaml:
name: app
version: 1.0.0+1
environment:
sdk: ">=2.16.0-80.1.beta <3.0.0"
dependencies:
flutter:
sdk: flutter
cupertino_icons: ^1.0.2
flutter_login: ^3.1.0
font_awesome_flutter: ^9.2.0
flutter_secure_storage: ^5.0.2
flutter_bloc: ^8.0.1
shared_preferences: ^2.0.12
equatable: ^2.0.3
json_annotation: ^4.4.0
dev_dependencies:
flutter_test:
sdk: flutter
flutter_lints: ^1.0.0
build_runner: ^2.1.7
flutter:
uses-material-design: true
I did of course try to run $(flutter) pub get, update flutter channel to the latest master and dev, run $flutter packages pub run build_runner watch, but to no avail...
The dev channel in particular lists "Dart 2.16.0 (build 2.16.0-134.1.beta)" as a dependency tool, but I still get the same compile error.
Just got back to this project, with a fresh mind, and I quickly fixed the issue by changing the environment sdk to ">=2.15.1 <3.0.0".

Flutter dart null safety migration dont work because of package flutter_template_images

I want to migrate my project to null safety but the dependecie flutter_template_images is not supporting null safety:
Package Name Current Upgradable Resolvable Latest
direct dependencies:
flutter_template_images ✗4.0.0 ✗4.0.0 ✗4.0.0 ✗4.0.0
dev_dependencies: all support null safety.
You are already using the newest resolvable versions listed in the 'Resolvable' column.
Newer versions, listed in 'Latest', may not be mutually compatible.
I dont know where this package comes from and I dont find it in the pubspec.yaml file. Can I migrate null safety without upgrading this dependencie?
EDIT:
This is my pubspec.yaml file:
environment:
sdk: ">=2.7.0 <3.0.0"
dependencies:
flutter:
sdk: flutter
material_design_icons_flutter: ^4.0.5955
pdf: ^3.3.0
path_provider: ^2.0.2
provider: ^6.0.0
open_file: ^3.2.1
intl: ^0.17.0
# The following adds the Cupertino Icons font to your application.
# Use with the CupertinoIcons class for iOS style icons.
cupertino_icons: ^1.0.2
cloud_firestore: ^2.3.0
get: ^4.1.4
printing: ^5.4.3
google_sign_in: ^5.0.5
firebase_auth: ^3.0.1
fl_chart: ^0.36.3
url_launcher: ^6.0.9
sqflite: ^2.0.0+4
It appears the maintainer has not migrated the package to dart-null-safety, you could either wait for the maintainer to migrate the package or clone the package and migrate the package yourself.
Another option could be that you remove the package from your project.
For more clarification dart-null-safety

How do i upgrade my current flutter project to its latest dependencies packages and latest version of flutter?

I have cloned an old flutter project and need to update it's dependencies and version of flutter. What are the steps needed to do this correctly from what i have gathered in the terminal i would run in this order the following commands:
flutter upgrade
dart migrate
flutter pub upgrade --major-versions
dart migrate
i will include my pubspec.yaml:
pubspec.yaml
name: vtc_sentry_fl
description: A new Flutter project.
version: 0.2.1+5
environment:
sdk: ">=2.1.0 <3.0.0"
dependencies:
flutter:
sdk: flutter
flutter_localizations:
sdk: flutter
cupertino_icons: ^0.1.3
http: ^0.12.1
shared_preferences: ^0.5.7+3
flag: ^1.0.0
auto_size_text: ^2.1.0
firebase_messaging: ^6.0.15
date_range_picker: ^1.0.6
intl: ^0.16.0
flutter_launcher_icons: ^0.7.4
fl_chart: ^0.9.4
flutter_icons:
android: true
ios: true
image_path: "assets/images/vt_icon_logo.png"
dev_dependencies:
flutter_test:
sdk: flutter
flutter:
uses-material-design: true
fonts:
- family: Montserrat
fonts:
- asset: assets/fonts/Montserrat-Medium.ttf
- asset: assets/fonts/Montserrat-Light.ttf
- asset: assets/fonts/Montserrat-Bold.ttf
assets:
- assets/images/
To upgrade Flutter run flutter upgrade and adjust the SDK version as mentioned by Kartik Patel.
However, in order to upgrade the project's dependencies you have to be careful. I suggest you check out the website of each dependency on pub.dev and read the change logs. Newer versions might introduce breaking changes.
You can run flutter pub outdated to list outdated packages and even show their transitive dependencies, you can then update the version of the packages in pubspec.yaml and run flutter pub upgrade to perform the upgrade.
run flutter upgrade command to update flutter and flutter pub upgrade to update all dependencies from pubspec.yaml file, and use latest sdk version in pubspec.yaml file:
environment:
sdk: ">=2.12.0 <3.0.0"

How to solve multi dependency version conflicts simply?

I have imported a project in android studio flutter. But, there is an incredible amount of version conflict coming in. If one solves other rises and if that goes down, other one rises. I am trying to get all packages and it is showing me the following error as below.
Because date_utils >=0.1.0+3 depends on intl ^0.16.0 and prokit_flutter depends on intl 0.17.0-nullsafety.2, date_utils >=0.1.0+3 is forbidden.
So, because prokit_flutter depends on date_utils ^0.1.0+3, version solving failed.
pub get failed (1; So, because prokit_flutter depends on date_utils ^0.1.0+3, version solving failed.)
Process finished with exit code 1
And my pubspec.yaml code is as below.
name: prokit_flutter
description: A new Flutter application.
version: 1.0.0+1
environment:
sdk: ">=2.6.0 <3.0.0"
dependencies:
flutter:
sdk: flutter
cupertino_icons: ^1.0.0
url_launcher: 5.0.3
nb_utils: 3.1.6+7
google_fonts: 1.1.0
animations: 1.1.2
intl: 0.17.0-nullsafety.2
http: 0.12.2
firebase_core: 0.5.0
firebase_analytics: 6.0.0
firebase_crashlytics: 0.1.4+1
google_sign_in: 4.5.3
html: 0.14.0+3
share: 0.6.5
mobx: ^1.2.1+2
flutter_mobx: ^1.1.0+2
flutter_statusbarcolor: 0.2.3
simple_animations: 1.3.8
snaplist: 0.1.8
flutter_svg: 0.18.1
flutter_slidable: 0.5.7
flutter_staggered_grid_view: 0.3.2
flutter_staggered_animations: 0.1.2
geolocator: 5.3.2+2
geocoder: 0.2.1
google_maps_flutter: 0.5.21+3
clustering_google_maps: 0.1.2
razorpay_flutter: 1.2.2
signature: 3.2.0
liquid_swipe: 1.5.0
lipsum: 1.0.1
flutter_colorpicker: 0.3.4
clippy_flutter: 1.1.1
flutter_tags: ^0.4.8
image_picker_gallery_camera: 0.1.6
video_player: 0.10.11+2
charts_flutter: ^0.9.0
like_button: ^1.0.1
flutter_reaction_button: ^1.0.1
lottie: ^0.6.0
showcaseview: ^0.1.6
date_utils: ^0.1.0+3
cached_network_image: ^2.3.1
flutter_localizations:
sdk: flutter
dev_dependencies:
flutter_test:
sdk: flutter
mobx_codegen:
build_runner: ^1.9.0
#flutter packages pub run build_runner build
flutter:
uses-material-design: true
assets:
- images/smartDeck/images/
fonts:
- family: Andina
fonts:
- asset: fonts/andina.ttf
And there are 4-5 dependency version error. How can I solve this version error thing in one click or I can just somehow skip this version problem and get the thing done. Please help, Thanks in Advance.
Whenever conflicts between dependencies occur, the simplest solution is to just remove the version number of both that dependencies and type 'any' without quotes in front of them.
for example let's say this following two dependency conflicts:
shared_preferences: ^0.5.7+3
requests: ^3.3.0
then do following:
shared_preferences: any
requests: any
After this do pub get and issue will be resolved. Now, most importantly, don't leave any dependency on this form. instead goto pubspec.lock file and search these two dependencies. Flutter itself chooses the versions that don't conflict, copy those and replace it to pubsec.yaml
You can use dependency_overrides in your pubspec.yaml to force a specific package version. The package version will override any reference to a dependency in the entire app.
In your case you could use
dependencies:
flutter:
sdk: flutter
...
cupertino_icons: ^1.0.0
dependency_overrides:
intl: ^0.17.0-nullsafety.2
See dependency_overrides for more information.
Replace intl: 0.17.0-nullsafety.2 version with intl: 0.16.1 and remove intl from dependency overrides.
Now, run pub get command.
You can simply change the version of package that is causing conflic with another version which is compatible with your dart SDK. I tried it and the problem was solved.
had the same problem; ran the following command:
flutter pub upgrade --major-versions
if you don't mind having the latest version of all the dependencies while solving version conflict issues, this should be a quick fix.
I had this problem after resetting my Mac mini.
If you still have the pubspec.lock file at the last successful run (or get it from another dev, on that dev's computer the project is still running).
flutter clean.
Replace pubspec.lock by the old one.
Run the project again.