Flutter项目Dart-sdk版本拒绝更新



每当我尝试运行应用程序时,都会收到这个错误。我尝试了从升级flutter到添加dependency_overrides的所有方法,但都没有成功。

/C:/Source/Flutter/flutter/.pub-cache/hosted/pub.dartlang.org/cloud_firestore_web-2.6.9/lib/src/internals.dart:11:20: Error: Method not found: 'guardWebExceptions'.
return internals.guardWebExceptions(
^^^^^^^^^^^^^^^^^^
/C:/Source/Flutter/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_storage_web-3.2.9/lib/src/utils/errors.dart:20:20: Error: Method not found: 'guardWebExceptions'.
return internals.guardWebExceptions(
^^^^^^^^^^^^^^^^^^
/C:/Source/Flutter/flutter/.pub-cache/hosted/pub.dartlang.org/cloud_firestore_platform_interface-5.5.0/lib/src/method_channel/method_channel_firestore.dart:112:15: Error: Member not found: 'Error.throwWithStackTrace'.
Error.throwWithStackTrace(
^^^^^^^^^^^^^^^^^^^
/C:/Source/Flutter/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_auth_platform_interface-6.2.0/lib/src/method_channel/utils/exception.dart:14:11: Error: Member not found: 'Error.throwWithStackTrace'.
Error.throwWithStackTrace(exception, stackTrace);
^^^^^^^^^^^^^^^^^^^
/C:/Source/Flutter/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_auth_platform_interface-6.2.0/lib/src/method_channel/utils/exception.dart:17:9: Error: Member not found: 'Error.throwWithStackTrace'.
Error.throwWithStackTrace(
^^^^^^^^^^^^^^^^^^^
/C:/Source/Flutter/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_auth_platform_interface-6.2.0/lib/src/method_channel/utils/exception.dart:12:7: Error: A non-null value must be returned since the return type 'Never' doesn't allow null.
Never convertPlatformException(Object exception, StackTrace stackTrace) {
^
/C:/Source/Flutter/flutter/.pub-cache/hosted/pub.dartlang.org/cloud_firestore_platform_interface-5.5.0/lib/src/method_channel/utils/exception.dart:14:11: Error: Member not found: 'Error.throwWithStackTrace'.
Error.throwWithStackTrace(exception, stackTrace);
^^^^^^^^^^^^^^^^^^^
/C:/Source/Flutter/flutter/.pub-cache/hosted/pub.dartlang.org/cloud_firestore_platform_interface-5.5.0/lib/src/method_channel/utils/exception.dart:17:9: Error: Member not found: 'Error.throwWithStackTrace'.
Error.throwWithStackTrace(
^^^^^^^^^^^^^^^^^^^
/C:/Source/Flutter/flutter/.pub-cache/hosted/pub.dartlang.org/cloud_firestore_platform_interface-5.5.0/lib/src/method_channel/utils/exception.dart:12:7: Error: A non-null value must be returned since the return type 'Never' doesn't allow null.
Never convertPlatformException(Object exception, StackTrace stackTrace) {
^
/C:/Source/Flutter/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_storage_platform_interface-4.1.0/lib/src/method_channel/utils/exception.dart:19:11: Error: Member not found: 'Error.throwWithStackTrace'.
Error.throwWithStackTrace(exception, stackTrace);
^^^^^^^^^^^^^^^^^^^
/C:/Source/Flutter/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_storage_platform_interface-4.1.0/lib/src/method_channel/utils/exception.dart:22:9: Error: Member not found: 'Error.throwWithStackTrace'.
Error.throwWithStackTrace(
^^^^^^^^^^^^^^^^^^^
/C:/Source/Flutter/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_storage_platform_interface-4.1.0/lib/src/method_channel/utils/exception.dart:14:7: Error: A non-null value must be returned since the return type 'Never' doesn't allow null.
Never convertPlatformException(
^

我注意到,尽管我进行了更新,但我的pubspec.yaml文件中的sdk版本仍然保持不变。根据其他解决方案,它应该是">2.16.0<3.0.0英寸开始工作。

environment:
sdk: ">=2.15.0 <3.0.0"

如果我尝试手动更改它,它会抛出这个错误

The current Dart SDK version is 2.15.0.
Because purple requires SDK version >=2.16.0 <3.0.0, version solving failed.
pub get failed (1; Because purple requires SDK version >=2.16.0 <3.0.0, version solving failed.)

这是我输入flutter --version后得到的输出

Flutter 2.10.4 • channel stable • https://github.com/flutter/flutter.git
Framework • revision c860cba910 (3 days ago) • 2022-03-25 00:23:12 -0500
Engine • revision 57d3bac3dd
Tools • Dart 2.16.2 • DevTools 2.9.2

将其添加到您的pubsepc.yaml文件中

dependency_overrides:
firebase_storage_platform_interface: 4.0.14

高于

dev_dependencies:
flutter_test:
sdk: flutter

最新更新