【问题标题】:Flutter Firebase Unsopported class loaderFlutter Firebase 不支持的类加载器
【发布时间】:2019-06-28 14:42:17
【问题描述】:

我正在使用 Flutter 和 Firebase 构建应用。我有部分代码在工作,即

 final collection = Firestore.instance.collection('regions').orderBy('region_id');
 collection.getDocuments().then((data){
     print(data);
   })
 .catchError((e){print(e);});

在那之后我得到了

W/.example.herme(13551): Unsupported class loader
I/.example.herme(13551): The ClassLoaderContext is a special shared library.
I/.example.herme(13551): The ClassLoaderContext is a special shared library.
W/.example.herme(13551): Skipping duplicate class check due to unsupported classloader
I/.example.herme(13551): The ClassLoaderContext is a special shared library.
W/.example.herme(13551): Accessing hidden method Ljava/security/spec/ECParameterSpec;->getCurveName()Ljava/lang/String; (light greylist, reflection)

以此类推,在 firebase firestore 中,我有一个名为 region 的集合,上面有 16 个文档,每个文档里面都有一个名为 comune 的集合,上面有文档。

这个错误是什么意思?跟收藏有关系吗?

【问题讨论】:

  • 你有没有发现是什么导致了这个消息?
  • 是的。显然,该功能不适用于颤振。我正在使用一个名为 query 的 dart 存档,但调用它们时只是返回 Firestore.instance.collection('x').getDocuments;所以我有 Query.getdoc('x').then((data){});它现在工作正常

标签: firebase flutter google-cloud-firestore


【解决方案1】:

这个问题的最初原因是你在 Flutter cloud_firestore 上使用了一个过时的函数。目前,您可以使用 Query.get() 获取集合中的所有文档 - 其中 Query 包含 Firestore 集合查询。

FirebaseFirestore.instance
    .collection('regions')
    .orderBy('region_id')
    .get()
    .then((QuerySnapshot snapshot) {
      snapshot.docs.forEach((QueryDocumentSnapshot element) {
        /// call element.data() for the DocumentSnapshot
        debugPrint('getDocuments id: ${element.id} data: ${element.data()}');
      }
    });

【讨论】:

    猜你喜欢
    • 2014-11-19
    • 2018-03-27
    • 1970-01-01
    • 1970-01-01
    • 2016-08-21
    • 1970-01-01
    • 2019-07-14
    • 2011-10-04
    • 1970-01-01
    相关资源
    最近更新 更多