如何在Dart SDK版本3.0.3上为安装geoflutterfire启用空安全性?

jvidinwx  于 2023-07-31  发布在  Flutter
关注(0)|答案(2)|浏览(183)

我得到了这个错误时,试图安装geoflutterfire的终端。但我的SDK比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

字符串
我在pubspec.yaml cloud_firestore上的版本:^4.7.0 rxdart:0.27.7
我试图寻找一个解决方案来改变Dart SDK,但我发现在Dart 3中,空安全是内置的;你不能关掉它。(https://dart-ko.dev/resources/dart-3-migration)
有人能帮忙解决这个问题吗。然后安装geoflutterfire?先谢谢你。

6ovsh4lw

6ovsh4lw1#

面对这样的错误,我通常的策略是:
1.创建pubspec.yamlpubspec.lock的备份副本(git commit!)
1.将所有版本约束更改为“any”(或将其设置为空)

  1. flutter clean; flutter pub get
  • 如果 * 可以解决一些版本组合,我比较flutter pub deps的版本,看看是否有任何东西必须去一个主要的版本,如果是,检查他们的更改日志,看看是否有突破性的变化。

如果这一切都有意义,我会测试应用程序。如果 that 起作用,我小心地将依赖项从pubspec.lock复制回pubspec.yaml
我敢肯定有人会告诉我“哦,这只是Flutter酒吧SomeWeirdCommand做这一切”。好吧。这个管用。:)

pb3s4cty

pb3s4cty2#

有关resolving-dart-package-version-conflicts https://iiro.dev/resolving-dart-package-version-conflicts/的更多信息

相关问题