create method

Future create(
  1. Map<String, dynamic> data, {
  2. String? id,
})

Creates new document based on the provided data and id in the collection If id is null, id will be auto generated by firestore

Implementation

Future<dynamic> create(Map<String, dynamic> data, {String? id}) {
  if (id != null) {
    return _db.collection(collection).doc(id).set(data);
  } else {
    return _db.collection(collection).add(data);
  }
}