Flutter Flatter Firebase如何创建新系列?

Flutter Flatter Firebase如何创建新系列?,flutter,dart,google-cloud-firestore,Flutter,Dart,Google Cloud Firestore,我如何在我的Firebase Cloud Firestore中创建一个新集合,并在我的服务文件中使用dart和Flatter功能?我搜索了它,但我只能找到如何将数据添加到firebase中的现有集合。有人能帮我吗?请:)来自云Firestore文档(): CloudFireStore将数据存储在文档中,文档存储在集合中。首次向文档添加数据时,Cloud Firestore会隐式创建集合和文档。您不需要显式地创建集合或文档 因此,您需要做的是添加到集合中,如下所示,然后将创建您的集合: Fires

我如何在我的Firebase Cloud Firestore中创建一个新集合,并在我的服务文件中使用dart和Flatter功能?我搜索了它,但我只能找到如何将数据添加到firebase中的现有集合。有人能帮我吗?请:)

来自云Firestore文档():

CloudFireStore将数据存储在文档中,文档存储在集合中。首次向文档添加数据时,Cloud Firestore会隐式创建集合和文档。您不需要显式地创建集合或文档

因此,您需要做的是添加到集合中,如下所示,然后将创建您的集合:

Firestore.instance.collection("you_Collection_Path").add({
  "key":value //your data which will be added to the collection and collection will be created after this
}).then((_){
  print("collection created");
}).catchError((_){
  print("an error occured");
});