I got this error when try to install geoflutterfire by terminal. But my SDK is higher than 2.12.0.
ben@MacBook projectva % flutter pub add geoflutterfire
The current Dart SDK version is 3.0.3.
Because geoflutterfire >=3.0.0-nullsafety.1 <3.0.0-nullsafety.3 depends on rxdart ^0.26.0 and geoflutterfire >=3.0.0-nullsafety.3 <3.0.1 depends on cloud_firestore ^2.0.0, geoflutterfire
>=3.0.0-nullsafety.1 <3.0.1 requires rxdart ^0.26.0 or cloud_firestore ^2.0.0.
And because geoflutterfire <2.2.3 doesn't support null safety, geoflutterfire <2.2.3-∞ or >=3.0.0-nullsafety.1 <3.0.1-∞ requires rxdart ^0.26.0 or cloud_firestore ^2.0.0.
And because geoflutterfire >=2.2.3 <3.0.0-nullsafety.1 depends on cloud_firestore ^3.1.6 and geoflutterfire >=3.0.1 <3.0.2 depends on cloud_firestore ^2.3.0, geoflutterfire <3.0.2 requires
rxdart ^0.26.0 or cloud_firestore >=2.0.0 <3.0.0 or ^3.1.6.
And because geoflutterfire >=3.0.2 depends on cloud_firestore ^3.1.6 and okleva depends on cloud_firestore ^4.7.0, every version of geoflutterfire requires rxdart ^0.26.0.
So, because okleva depends on both rxdart ^0.27.7 and geoflutterfire any, version solving failed.
The lower bound of "sdk: '>=2.0.0-dev.28.0 <3.0.0'" must be 2.12.0 or higher to enable null safety.
For details, see https://dart.dev/null-safety
My versions on pubspec.yaml cloud_firestore: ^4.7.0 rxdart: ^0.27.7
I try search for a solution to change the Dart SDK but i found that In Dart 3, null safety is built in; you cannot turn it off. (https://dart-ko.dev/resources/dart-3-migration)
So can somebody help to solve this. And install geoflutterfire ? thanks in advance.
My usual strategy when facing such errors is to:
pubspec.yaml
and pubspec.lock
(git commit!)flutter clean; flutter pub get
If that can solve for some combination of versions, I compare the versions from flutter pub deps
and see if anything had to go a major version, and if so, review their changelog to see if there's breaking changes.
If that all makes sense, I test the app. If that works, I carefully copy the dependencies from pubspec.lock
back into pubspec.yaml
.
I'm sure someone will tell me "oh, that's just flutter pub SomeWeirdCommand to do it all". Oh well. This works. :)