delete method

Future<bool> delete(
  1. String? docId
)

Delete the Firebase entry by its String Id.

Implementation

Future<bool> delete(String? docId) async {
  if (docId == null || docId.trim().isEmpty) {
    return false;
  }
  bool delete = true;
  try {
    final DocumentReference ref = _collection!.doc(docId);
    delete = await ref.delete().then((_) {
      return true;
    }).catchError((Object ex) {
      setError(ex);
      return false;
    });
  } catch (ex) {
    setError(ex);
    delete = false;
  }
  return delete;
}