简体   繁体   English

flutter cloud-firestore MissingPluginException 异常

[英]flutter cloud-firestore MissingPluginException Exception

cannot use cloud firestore in flutter (android and IOS) ... I get this Exception:不能在 flutter (android 和 IOS) 中使用 cloud firestore ......我得到这个例外:

E/flutter (10137): [ERROR:flutter/lib/ui/ui_dart_state.cc(157)] Unhandled Exception: MissingPluginException(No implementation found for method DocumentReference#setData on channel plugins.flutter.io/cloud_firestore) E/flutter (10137): [ERROR:flutter/lib/ui/ui_dart_state.cc(157)] 未处理的异常:MissingPluginException(在频道 plugins.flutter.io/cloud_firestore 上找不到方法 DocumentReference#setData 的实现)

E/flutter (10137): #0 MethodChannel.invokeMethod (package:flutter/src/services/platform_channel.dart:319:7) E/flutter (10137): #0 MethodChannel.invokeMethod (package:flutter/src/services/platform_channel.dart:319:7)

E/flutter (10137): E/flutter (10137): #1 DocumentReference.setData (package:cloud_firestore/src/document_reference.dart:51:30) E/flutter (10137): E/flutter (10137): #1 DocumentReference.setData (package:cloud_firestore/src/document_reference.dart:51:30)

E/flutter (10137): #2 _MyHomePageState.build. E/flutter (10137):#2 _MyHomePageState.build。 (package:firestoretest/main.dart:41:16) (包:firestoretest/main.dart:41:16)

note:笔记:

This is my pubspec.yaml file:这是我的 pubspec.yaml 文件:

cloud_firestore: ^0.13.0+1 cloud_firestore:^0.13.0+1

collection: ^1.14.11集合:^1.14.11

firebase_core: ^0.4.3+1 firebase_core:^0.4.3+1

I configured firebase properly and it is connected as shown in firebase console .. and able to use firebase real-time database without problems我正确配置了 firebase 并按照 firebase 控制台所示进行连接 .. 并且能够毫无问题地使用 firebase 实时数据库

finally I figured out to work around the issue (keep in mind I am using flutter).最后我想出了解决这个问题(请记住我正在使用颤振)。 Actually firebase installation wasn't perfect from the start.实际上,firebase 的安装从一开始就不是完美的。 Even though in the documentation of firebase (for flutter) they said that explicitly we have to install the pods (ios packages), but actually we don't have to do anything related the pods other than adding an entry of the package (eg cloud_firestore) and execute flutter packages get .即使在 firebase 的文档(对于 flutter)他们明确说我们必须安装 pods(ios 包),但实际上除了添加包的条目(例如 cloud_firestore)之外,我们不需要做任何与 pods 相关的事情) 并执行flutter packages get I had to migrate the entire codebase to a new flutter project and within a few minutes, everything was fine.我不得不将整个代码库迁移到一个新的 Flutter 项目,几分钟内,一切都很好。

MissingPluginException Exception: MissingPluginException 异常:

I had this problem because I was not using the stable version of the flutter, after making the change through the command 'flutter channel stable' I was able to integrate my project with firebase.我遇到了这个问题,因为我没有使用 flutter 的稳定版本,在通过命令“flutter channel stable”进行更改后,我能够将我的项目与 firebase 集成。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM