未定义的名称“Firestore”颤振

时间:2021-02-06 07:46:58

标签: firebase flutter google-cloud-firestore

dependencies:
  flutter:
    sdk: flutter
    


  # The following adds the Cupertino Icons font to your application.
  # Use with the CupertinoIcons class for iOS style icons.
  cupertino_icons: ^1.0.2
  cloud_firestore:

我配置正确,请帮忙

4 个答案:

答案 0 :(得分:6)

没有名为 Firestore 的类。改用 FirebaseFirestore.instance

示例:

var snapshot = FirebaseFirestore.instance
          .collection('chat')
          .orderBy('createdAt', descending: true)
          .snapshots();

答案 1 :(得分:1)

使用这个pubspec.yaml

selectGraphQLResultFromTable

答案 2 :(得分:0)

示例

安装依赖:-

dependencies:
  flutter:
    sdk: flutter


  # The following adds the Cupertino Icons font to your application.
  # Use with the CupertinoIcons class for iOS style icons.
  cupertino_icons: ^1.0.0
  firebase_auth:
  cloud_firestore: ^0.14.3
  firebase_core: ^0.5.2

导入包:-

import 'package:cloud_firestore/cloud_firestore.dart';

访问 Firestore :-

Future getMembers() async {
    var firestore = FirebaseFirestore.instance;
    QuerySnapshot querySnapshot = await firestore.collection("Members").get();
    final documents = querySnapshot.docs;
    return documents
}

答案 3 :(得分:0)

将名称从“Firestore”更改为“FirebaseFirestore”。