deleteData method

Future<void> deleteData(
  1. String collectionName,
  2. String docName
)

Deletes a specified document from a collection.

The collectionName specifies the collection and docName specifies the document to be deleted. Prints the outcome of the operation.

Implementation

Future<void> deleteData(String collectionName, String docName) async {
  return obj
      .collection(collectionName)
      .doc(docName)
      .delete()
      .then((value) => print("User Deleted"))
      .catchError((error) => print("Failed to delete user: $error"));
}