我在运行我的应用程序(Flutter、FireBase)时收到此 E/flutter (25055) 错误
Posted
技术标签:
【中文标题】我在运行我的应用程序(Flutter、FireBase)时收到此 E/flutter (25055) 错误【英文标题】:I am getting this E/flutter (25055) error when I am running my App (Flutter , FireBase 【发布时间】:2021-10-20 08:37:48 【问题描述】:我在运行我的应用(Flutter、fireBase)时收到此 E/flutter (25055) 错误
我尝试更新我的颤振,但仍然得到相同的日志 这些日志使我的应用程序不稳定并且应用程序崩溃了很多
E/flutter (25055): [ERROR:flutter/lib/ui/ui_dart_state.cc(199)] Unhandled Exception: Bad state: field does not exist within the DocumentSnapshotPlatform
E/flutter (25055): #0 DocumentSnapshotPlatform.get._findKeyValueInMap (package:cloud_firestore_platform_interface/src/platform_interface/platform_interface_document_snapshot.dart:86:7)
E/flutter (25055): #1 DocumentSnapshotPlatform.get._findComponent (package:cloud_firestore_platform_interface/src/platform_interface/platform_interface_document_snapshot.dart:104:41)
E/flutter (25055): #2 DocumentSnapshotPlatform.get (package:cloud_firestore_platform_interface/src/platform_interface/platform_interface_document_snapshot.dart:120:26)
E/flutter (25055): #3 _JsonDocumentSnapshot.get (package:cloud_firestore/src/document_snapshot.dart:92:48)
E/flutter (25055): #4 _JsonDocumentSnapshot.[] (package:cloud_firestore/src/document_snapshot.dart:96:40)
E/flutter (25055): #5 _MyHomePageState.getLists (package:form_app/pages/home.dart:518:30)
E/flutter (25055): <asynchronous suspension>
E/flutter (25055): #6 _MyHomePageState._getUnitNamesData (package:form_app/pages/home.dart:495:33)
E/flutter (25055): <asynchronous suspension>
E/flutter (25055):
我的 Flutter 医生
C:\src\flutter\bin\flutter.bat 医生 --verbose [√] Flutter (Channel stable, 2.2.3, on Microsoft Windows [Version 10.0.19041.450], locale en-US) • Flutter 2.2.3 版,位于 C:\src\flutter • 框架修订 f4abaa0735(7 周前),2021-07-01 12:46:11 -0700 • 引擎版本 241c87ad80 • Dart 版本 2.13.4
[√] android 工具链 - 为 Android 设备开发(Android SDK 版本 30.0.2) • C:/Users/afran/AppData/Local/Android/Sdk 中的 Android SDK • 平台 android-30,构建工具 30.0.2 • ANDROID_HOME = C:/Users/afran/AppData/Local/Android/Sdk • Java 二进制文件位于:C:\Program Files\Android\Android Studio\jre\bin\java • Java 版 OpenJDK 运行时环境(内部版本 11.0.8+10-b944.6842174) • 接受所有 Android 许可证。
[√] Chrome - 为网络开发 • C:\Program Files (x86)\Google\Chrome\Application\chrome.exe 中的 Chrome
[√] Android Studio(4.1.0版) • Android Studio 位于 C:\Program Files\Android\Android Studio • Flutter 插件可以从以下位置安装: https://plugins.jetbrains.com/plugin/9212-flutter • Dart 插件可以从以下位置安装: https://plugins.jetbrains.com/plugin/6351-dart • Java 版 OpenJDK 运行时环境(内部版本 11.0.8+10-b944.6842174)
[√] IntelliJ IDEA 终极版(2020.2版) • F:\IntelliJ IDEA 2020.2.3 上的 IntelliJ • Flutter 插件可以从以下位置安装: https://plugins.jetbrains.com/plugin/9212-flutter • Dart 插件可以从以下位置安装: https://plugins.jetbrains.com/plugin/6351-dart
[√] VS 代码(版本 1.55.2) • C:\Users\afran\AppData\Local\Programs\Microsoft VS 代码中的 VS 代码 • Flutter 扩展版本 3.21.0
[√] 已连接设备(2 个可用) • 为 x86(移动)构建的 Android SDK • emulator-5554 • android-x86 • Android 10 (API 29)(模拟器) • Chrome(网络) • chrome • web-javascript • Google Chrome 92.0.4515.131
• 未发现任何问题!
我的应用依赖项
dependencies:
flutter:
sdk: flutter
flutter_spinkit: ^5.0.0
geolocator: ^7.0.1
#geolocation: ^1.1.2
cloud_firestore: ^2.4.0
firebase_storage: ^10.0.1
permission_handler: ^8.1.4+2
firebase_core: ^1.0.1
url_launcher: ^6.0.2
firebase_auth: ^3.0.1
provider: ^5.0.0
google_fonts: ^2.0.0
shared_preferences: ^2.0.4
connectivity: ^3.0.2
mailer: ^5.0.1
firebase_messaging: ^10.0.4
flutter_local_notifications: ^5.0.0+1
【问题讨论】:
【参考方案1】:异常说明问题:
Unhandled Exception: Bad state: field does not exist within the DocumentSnapshotPlatform
还有调用方法:
E/flutter (25055): #0 DocumentSnapshotPlatform.get._findKeyValueInMap (package:cloud_firestore_platform_interface/src/platform_interface/platform_interface_document_snapshot.dart:86:7)
E/flutter (25055): #1 DocumentSnapshotPlatform.get._findComponent (package:cloud_firestore_platform_interface/src/platform_interface/platform_interface_document_snapshot.dart:104:41)
E/flutter (25055): #2 DocumentSnapshotPlatform.get (package:cloud_firestore_platform_interface/src/platform_interface/platform_interface_document_snapshot.dart:120:26)
E/flutter (25055): #3 _JsonDocumentSnapshot.get (package:cloud_firestore/src/document_snapshot.dart:92:48)
E/flutter (25055): #4 _JsonDocumentSnapshot.[] (package:cloud_firestore/src/document_snapshot.dart:96:40)
E/flutter (25055): #5 _MyHomePageState.getLists (package:form_app/pages/home.dart:518:30)
E/flutter (25055): <asynchronous suspension>
E/flutter (25055): #6 _MyHomePageState._getUnitNamesData (package:form_app/pages/home.dart:495:33)
E/flutter (25055): <asynchronous suspension>
E/flutter (25055):
您必须检查这些行会发生什么。我们无法调试它,因为我们没有代码。您要求一个不存在的字段,因此它会引发此异常。
【讨论】:
以上是关于我在运行我的应用程序(Flutter、FireBase)时收到此 E/flutter (25055) 错误的主要内容,如果未能解决你的问题,请参考以下文章
我该如何解决这个问题:Android Studio - Flutter - Dart - firebase [关闭]
Flutter 现有项目到 WebApp + Firebase (Firestore + Hosting)
构建 Flutter iOS 应用程序时出错 - Firebase