在pubspec.yaml我的Flutter项目的文件中^,某些依赖项的版本号之前有一个插入符号()。
dependencies:
flutter:
sdk: flutter
cupertino_icons: ^0.1.2
english_words: ^3.1.5
Run Code Online (Sandbox Code Playgroud)
目的是什么?这是什么意思?
笔记
/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'.\n Error.throwWithStackTrace(exception, stackTrace);\n ^^^^^^^^^^^^^^^^^^^\n/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'.\nError.throwWithStackTrace(\n ^^^^^^^^^^^^^^^^^^^\n/D:/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.\n\nNever convertPlatformException(Object exception, StackTrace stackTrace) {\n ^\nFAILURE: Build failed with an exception.\nRun Code Online (Sandbox Code Playgroud)\n我的 pubsec.yaml 只有:
\n导入 firebase 包后出现此错误。
\nDoctor summary (to see all details, run flutter doctor -v):\n[\xe2\x88\x9a] Flutter (Channel master, 2.6.0-12.0.pre.657, on Microsoft Windows [Version …Run Code Online (Sandbox Code Playgroud) firebase firebase-authentication flutter google-cloud-firestore
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) 在调试模式下在 sdk gphone64 arm64 上启动 lib/main.dart...运行 Gradle 任务 'assembleDebug'... ../../Downloads/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_auth_platform_interface- 6.2.0/lib/src/method_channel/utils/exception.dart:14:11:错误:找不到成员:“Error.throwWithStackTrace”。Error.throwWithStackTrace(异常,stackTrace); ^^^^^^^^^^^^^^^^^^^^ ../../Downloads/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_auth_platform_interface-6.2.0/lib/ src/method_channel/utils/exception.dart:17:9:错误:找不到成员:“Error.throwWithStackTrace”。Error.throwWithStackTrace( ^^^^^^^^^^^^^^^^^^^^ ../../Downloads/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_auth_platform_interface-6.2. 0/lib/src/method_channel/utils/exception.dart:12:7:错误:必须返回非空值,因为返回类型“Never”不允许为 null。Never ConvertPlatformException(对象异常,StackTrace stackTrace) { ^ ../../Downloads/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.throwWithStackTrace'.Error.throwWithStackTrace( ^^^^^^^^^^^^^^^^^^^^ ../../Downloads/flutter/.pub-cache/hosted/pub.dartlang .org/cloud_firestore_platform_interface-5.5.0/lib/src/method_channel/utils/exception.dart:14:11:错误:找不到成员:'Error.throwWithStackTrace'。Error.throwWithStackTrace(异常,stackTrace); ^^^^ ^^^^^^^^^^^^^^^ ../../Downloads/flutter/.pub-cache/hosted/pub.dartlang.org/cloud_firestore_platform_interface-5.5.0/lib/src/method_channel/ utils/exception.dart:17:9:错误:找不到成员:“Error.throwWithStackTrace”。Error.throwWithStackTrace( ^^^^^^^^^^^^^^^^^^^^ ../../Downloads/flutter/.pub-cache/hosted/pub.dartlang.org/cloud_firestore_platform_interface-5.5。 0/lib/src/method_channel/utils/exception.dart:12:7:错误:必须返回非空值,因为返回类型“Never”不允许为 null。Never ConvertPlatformException(对象异常,StackTrace stackTrace) { ^
失败:构建失败并出现异常。
- 出了什么问题:任务“:app:compileFlutterBuildDebug”执行失败。进程“命令”/Users/omair/Downloads/flutter/bin/flutter”以非零退出值 1 完成
- 尝试:使用 --stacktrace 选项运行以获取堆栈跟踪。使用 --info 或 --debug 选项运行以获得更多日志输出。使用 --scan 运行以获得完整的见解。
- 在https://help.gradle.org获取更多帮助
13 秒内构建失败异常:Gradle 任务 assembleDebug 失败,退出代码 1'''
知道这里出了什么问题吗?尝试使用不同版本的 firebase_auth 但没有解决。
当前版本是:
firebase_core:^1.12.0 firebase_analytics:^9.1.0 firebase_auth:^3.3.7 firebase_dynamic_links:^4.0.6 cloud_firestore:^3.1.9 fluttertoast:^8.0.9
谢谢 :)
我的测试无法在我的 Flutter 项目引用的仅 Dart 项目中编译和运行。我收到以下错误消息
\nFailed to precompile test:test:\n../../../../../../../../../.pub-cache/hosted/pub.dartlang.org/analyzer-1.0.0/lib/src/error/best_practices_verifier.dart:1952:14: Error: A non-null value must be returned since the return type \'String\' doesn\'t allow null.\n String get displayString {\nRun Code Online (Sandbox Code Playgroud)\n有什么想法吗?
\nFlutter 2.2.1 (current stable channel)\nTools \xe2\x80\xa2 Dart 2.13.1\nRun Code Online (Sandbox Code Playgroud)\n(我也在 Flutter 的 github 中提出了这个问题)\n https://github.com/flutter/flutter/issues/83683
\n