updateData method

Future<void> updateData(
  1. String collectionName,
  2. String docName,
  3. Map<String, dynamic> data
)

Updates data in a specified document within a collection.

The collectionName specifies the collection and docName specifies the document to be updated. The data is the map containing the data to be updated. Prints the outcome of the operation.

Implementation

Future<void> updateData(
    String collectionName, String docName, Map<String, dynamic> data) async {
  return await obj
      .collection(collectionName)
      .doc(docName)
      .update(data)
      .then((value) => print("Data Updated"))
      .catchError((error) => print("Failed to update data: $error"));
}