deleteUser method

Future<void> deleteUser(
  1. String id
)

This method deletes a user record from Firestore. @param id The ID of the user whose record is to be deleted. @throws String if the user record does not exist. @throws String if there is an error deleting the user record.

Implementation

Future<void> deleteUser(String id) async {
  try {
    await _db.collection("users").doc(id).delete();
  } on FirebaseAuthException catch (e) {
    final result = TExceptions.fromCode(e.code);
    throw result.message;
  } on FirebaseException catch (e) {
    throw e.message.toString();
  } catch (_) {
    throw 'Something went wrong. Please Try Again';
  }
}