После collection
вы можете добавить document
и получить DocumentReference
.
final docRef = await Firestore.instance.collection('product').add({
'name': nameController.text,
'price': int.tryParse(priceController.text),
'description': descriptionController.text,
'creator': widget.user.uid,
'created': DateTime.fromMillisecondsSinceEpoch(created.creationTimeMillis, isUtc: true).toString(),
'modified': DateTime.fromMillisecondsSinceEpoch(created.updatedTimeMillis, isUtc: true).toString(),
'url': downloadUrl,
});
Теперь вы можете получить идентификатор документа:
docRef.documentID