相关疑难解决方法(0)

Flutter的pubspec.yaml中的依赖版本号之前的插入号(^)是什么?

pubspec.yaml我的Flutter项目的文件中^,某些依赖项的版本号之前有一个插入符号()。

dependencies:
  flutter:
    sdk: flutter
  cupertino_icons: ^0.1.2
  english_words: ^3.1.5
Run Code Online (Sandbox Code Playgroud)

目的是什么?这是什么意思?

笔记

dart dart-pub flutter

22
推荐指数
2
解决办法
2383
查看次数

Flutter Firebase Auth 包出现“错误:找不到成员”

 /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.\n
Run Code Online (Sandbox Code Playgroud)\n

我的 pubsec.yaml 只有:

\n
    \n
  • 云火存储:
  • \n
  • firebase_核心:
  • \n
  • uuid:
  • \n
  • firebase_auth:^3.3.8
  • \n
  • 提供者:^6.0.2
  • \n
\n

导入 firebase 包后出现此错误。

\n
Doctor 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

15
推荐指数
2
解决办法
2万
查看次数

Flutter - 添加 Firebase 消息传递时出现问题

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 个可用)

\n

我的 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

\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: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)

flutter firebase-cloud-messaging

12
推荐指数
4
解决办法
2万
查看次数

颤振错误:“Error.throwWithStackTrace”

在调试模式下在 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) { ^

失败:构建失败并出现异常。

  • 其中:脚本'/Users/omair/Downloads/flutter/packages/flutter_tools/gradle/flutter.gradle'行:1070
  • 出了什么问题:任务“:app:compileFlutterBuildDebug”执行失败。进程“命令”/Users/omair/Downloads/flutter/bin/flutter”以非零退出值 1 完成
  • 尝试:使用 --stacktrace 选项运行以获取堆栈跟踪。使用 --info 或 --debug 选项运行以获得更多日志输出。使用 --scan 运行以获得完整的见解。

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

谢谢 :)

android gradle firebase flutter

5
推荐指数
0
解决办法
402
查看次数

Flutter编译错误:必须返回非空值,因为返回类型“String”不允许为空 - displayString

我的测试无法在我的 Flutter 项目引用的仅 Dart 项目中编译和运行。我收到以下错误消息

\n
Failed 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 {\n
Run Code Online (Sandbox Code Playgroud)\n

有什么想法吗?

\n
Flutter 2.2.1 (current stable channel)\nTools \xe2\x80\xa2 Dart 2.13.1\n
Run Code Online (Sandbox Code Playgroud)\n

(我也在 Flutter 的 github 中提出了这个问题)\n https://github.com/flutter/flutter/issues/83683

\n

dart flutter

4
推荐指数
1
解决办法
3759
查看次数