setData method
Adds or replaces data in a specified document within a collection.
The collectionName
specifies the collection in which to add the document,
and docName
specifies the document name. The data
is the map containing
the data to be added. Prints the outcome of the operation.
Implementation
Future<void> setData(
String collectionName, String docName, Map<String, dynamic> data) async {
return await obj
.collection(collectionName)
.doc(docName)
.set(data)
.then((value) => print("Data Added"))
.catchError((error) => print("Failed to add Data: $error"));
}