createSubDocument method

Future<void> createSubDocument(
  1. String collectionPath,
  2. String docId,
  3. String subCollection,
  4. Map<String, dynamic> data,
)

Add a subdocument to a specific document in a collection.

collectionPath - The path of the parent collection. docId - The ID of the parent document. subCollection - The name of the subcollection within the parent document. data - A map containing the data for the subdocument.

Implementation

Future<void> createSubDocument(
    String collectionPath, String docId, String subCollection, Map<String, dynamic> data) async {
  await _db.collection(collectionPath).doc(docId).collection(subCollection).add(data);
}