Doctor 摘要(要查看所有详细信息,请运行 flutter doctor -v):
\n[\xe2\x88\x9a] Flutter(频道稳定,2.5.0,在 Microsoft Windows 上 [Versi\xc3\x83\xc2\xb3n 10.0.19042.1348 ],区域设置 en-US)
\n[\xe2\x88\x9a] Android 工具链 - 为 Android 设备开发(Android SDK 版本 30.0.0-rc2)
\n[\xe2\x88\x9a] Chrome - 为网络开发
\n[\xe2\x88\x9a] Android Studio(版本 3.6)
\n[\xe2\x88\x9a] VS Code(版本 1.52.1)
\n[\xe2\x88\x9a] 连接的设备(3 个可用)
我的 pubsec.yaml 只有:
\nfirebase_messaging: ^10.0.1
\nfirebase_core: ^1.2.1
\nflutter_local_notifications: ^6.1.0
\n
\n即使在全新的 Flutter 项目上我遇到的问题是我得到以下内容当我添加 import 'package:firebase_messaging/firebase_messaging.dart'; 时出错;到 main.dart
/D:/Flutter/flutter_windows_2.5.0-stable/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_messaging_platform_interface-3.2.0/lib/src/method_channel/utils/exception.dart:13:11: Error: Method not found: 'Error.throwWithStackTrace'.\n Error.throwWithStackTrace(exception, stackTrace);\n ^^^^^^^^^^^^^^^^^^^\n/D:/Flutter/flutter_windows_2.5.0-stable/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_messaging_platform_interface-3.2.0/lib/src/method_channel/utils/exception.dart:16:9: Error: Method not found: 'Error.throwWithStackTrace'.\n Error.throwWithStackTrace(\n ^^^^^^^^^^^^^^^^^^^\n/D:/Flutter/flutter_windows_2.5.0-stable/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_messaging_platform_interface-3.2.0/lib/src/method_channel/utils/exception.dart:11:7: Error: A non-null value must be …Run Code Online (Sandbox Code Playgroud) 因此,我尝试开始使用 Riverpod 并使用“点击和计数器”默认示例创建一个新的 Flutter 项目。\n一旦我添加了 pubspec
\nflutter_hooks: ^0.18.0\nhooks_riverpod: ^2.0.0\nRun Code Online (Sandbox Code Playgroud)\n和
\n\n\n导入'包:hooks_riverpod / hooks_riverpod.dart';
\n
我在调试控制台上收到此错误,但无法找出问题所在
\n: Error: Method not found: 'Error.throwWithStackTrace'.\n../\xe2\x80\xa6/framework/provider_base.dart:904\n Error.throwWithStackTrace(error, chain);\n ^^^^^^^^^^^^^^^^^^^\n: Error: A non-null value must be returned since the return type 'Never' doesn't allow null.\n../\xe2\x80\xa6/framework/provider_base.dart:898\nNever _rethrowProviderError(Object error, StackTrace stackTrace) {\n ^\nRun Code Online (Sandbox Code Playgroud)\n