addDocumentWithCustomId method

Future<DocumentReference<Object?>> addDocumentWithCustomId(
  1. String id,
  2. Map<String, dynamic> data
)

Implementation

Future<DocumentReference> addDocumentWithCustomId(String id, Map<String, dynamic> data) async {
  var doc = ref!.doc(id);

  return await doc.set(data).then((value) {
    log('Added: $data');

    return doc;
  }).catchError((e) {
    log(e);
    throw e;
  });
}