My code was working without problem. After upgrading flutter, pug get is giving error:
But when I set intl to intl 0.17.0 , I got another error
How can I solve this. Is it possible to go back in the old version of flutter? Thanks
The best way would be just remove the version from the dependencies which are causing error. And then run pub get it will automatically take the best version combination.
For example replace :-
intl: ^0.17.0
with
intl:
You can try overriding the dependencies with:
dependencies:
...
dependency_overrides:
# intl: any
intl: ^0.17.0-nullsafety.2
Try overriding with specific version to limit the problem.
Related
I'm currently following FreeCodeCamp's tutorial on Youtube on how to make a Flutter Instagram clone, and I'm getting this error when I try to compile my code to run on Chrome.
These are my dependencies:
cloud_firestore: ^4.3.1
cupertino_icons: ^1.0.2
firebase_auth: ^4.2.5
firebase_core: ^2.4.1
firebase_storage: ^11.0.10
After some more testing, it seems that updating firebase_core to version 2.0.0 is what is causing this error. However, my other dependencies depend on firebase_core 2.0.0, so going backwards isn't an option.
For some reason, when I switched my IDE from VSCode to IntelliJ IDEA, my issue with the firebase packages was fixed. When I tried running it on VSCode again, I didn't didn't experience this problem again. I checked the pubspec.yaml files and they look the same.
Why I can't add an integration test in my pubspec.yaml. Can't someone help me how to solve this problem?
This package has been deprecated and the way you have added it in your pubspec is not the correct way. Please try using it like this along with Flutter 2.x.x
dev_dependencies:
integration_test:
sdk: flutter
Reference: https://pub.dev/packages/integration_test
i need some help because im going crazy. I just want to format date to my locale (should be it-IT).
In flutter app i putted in pubspec.yaml the intl package with the new nullsafety feature:
flutter:
sdk: flutter
intl: ^0.17.0-nullsafety.2
looking into the documentation it says:
<< Note that before doing any DateTime formatting for a particular locale, you must load the appropriate data by calling: >>
import 'package:intl/date_symbol_data_local.dart';
...
initializeDateFormatting('de_DE', null).then(formatDates);
(https://pub.dev/packages/intl/versions/0.17.0-nullsafety.2)
so, just to try, i did:
initializeDateFormatting('it-IT', null).then((value) => {print('intl ok')});
but the dart nullsafety doesnt want a null parameter, and it says "The argument type 'Null' can't be assigned to the parameter type 'String'."
Any suggestion?
Thread: flutter intl 0.17.0 package initializeDateFormatting.
Same problem here, did you solve the issue?
I tried upgrading intl to ^0.18.0, but in my pubspec.yaml I am using
flutter_localizations: # Add this line
sdk: flutter
so, my project is coupled with intl 0.17.0. I realize this when I tried the [flutter pub get] command and got this message:
Running "flutter pub get" in expenses...
**Because expenses depends on flutter_localizations from sdk which depends on intl 0.17.0, intl 0.17.0 is required.**
So, because expenses depends on intl ^0.18.0, version solving failed.
pub get failed (1; So, because expenses depends on intl ^0.18.0, version solving failed.)
I also made a lab with only dart and not flutter, and intl works as expected:
https://gist.github.com/ejyanezp/994c49f15bb2ce3fd4c3d84ed37ca198
So is a compatibility issue between flutter_localizations and intl.
Conclusion: i will go for a workaround and wait the final solution from the authors of both libraries.
In a Dart/Flutter project, I have
dependencies:
graphql: '^2.1.1-beta.5'
flutter_bloc: ^3.0.0
as dependencies. However, graphql depends on rxdart: ^0.22.0 and flutter_bloc depends on rxdart: ^0.23.0, which give me error:
Because flutter_bloc >=3.0.0 depends on bloc ^3.0.0 which depends on rxdart ^0.23.0, flutter_bloc >=3.0.0 requires rxdart ^0.23.0.
And because graphql 2.1.1-beta.5 depends on rxdart ^0.22.0 and no versions of graphql match >2.1.1-beta.5 <3.0.0, flutter_bloc >=3.0.0 is incompatible with graphql ^2.1.1-beta.5.
So, because com.myapp depends on both graphql ^2.1.1-beta.5 and flutter_bloc ^3.0.0, version solving failed.
My temporary fix is to downgrade flutter_bloc to ^2.1.1, which uses rxdart ^0.23.0. But if I want to use the latest and greatest version of flutter_bloc, what is the best solution?
Thanks!
You can use dependency overrides in pubspec.yaml:
dependency_overrides:
rx_dart: ^0.23.0
Note that plugins that depend on another version of the dependency you override can break if you do this.
Disclaimer: I am not the owner of the answer. I am just posting answer from reference: https://iiro.dev/resolving-dart-package-version-conflicts/
This helped me.
Let's say you have problem like this:
Because intl_translation 0.17.0 depends on petitparser ^1.1.3 and xml >=3.2.0
depends on petitparser ^2.0.0, intl_translation 0.17.0 is incompatible with xml >=3.2.0.
So, because my_project depends on both xml ^3.2.0 and intl_translation 0.17.0,
version solving failed.
The pubspec file might look a little something like this:
pubspec.yaml
dependencies:
# ...
xml: ^3.2.0
intl_translation: ^0.17.0
Solution:
The fastest way to resolve this problem is to set the versions of both of the conflicting dependencies to any.
pubspec.yaml
dependencies:
# ...
xml: any # <- don't leave me like this - read further!
intl_translation: any # <- don't leave me like this either!
^^This is not solution, there is one more step!
The output might like below:
Resolving dependencies...
Got dependencies!
After getting the project to build, you should tighten the dependency versions back to use semantic versioning like they previously did.
Open the generated pubspec.lock file and find the dependencies that were previously conflicting.
pubspec.lock
# Generated by pub
# See https://www.dartlang.org/tools/pub/glossary#lockfile
packages:
xml:
# ...
version: "3.0.1" # the version of "xml" package that worked fine
# with "intl_translation".
intl_translation:
# ...
version: "0.17.0" # the version of "intl_translation" package
# that worked fine with "xml".
From that lockfile, we can see that the xml package version 3.0.1 and intl_translation package version 0.17.0 play along together well.
As the last step, replace any with the correct versions on your pubspec file:
pubspec.yaml
dependencies:
# ...
xml: ^3.0.1
intl_translation: ^0.17.0
Refetch your dependencies one last time by running flutter packages get to verify that this does indeed work and then you’re good to go.
Answer credits: Iiro Krankka
Try this command: flutter pub upgrade --major-versions
I am trying to use the Jiffy package and the flutter localization package. Problem is now, that both are using the intl package, but with different versions. When I try "Packages get" I get the following error:
Because every version of flutter_localizations from sdk depends on intl 0.15.8 and every version of jiffy depends on intl ^0.16.0, flutter_localizations from sdk is incompatible with jiffy.
Is there a way to solve it? To use both version of intl for example?
Thanks
You just need to add this to your pubspec.yaml file:
dependency_overrides:
intl: ^0.16.0
go to your pubspec.yamal and
under of global_configuration:
set intl version like this :
dependency_overrides:
intl: ^0.15.8
and change it to :
dependency_overrides:
intl: ^0.16.0