delete property

Future<String> get delete

Deletes a document from the collection.

Removes a document from Firestore using the current UID.

Usage

final userId = await userCollection.delete;
print('User deleted: $userId');

Returns

  • String: The document ID that was deleted

Requirements

  • The UID must be set to a valid document ID
  • The document must exist in Firestore

Implementation

Future<String> get delete async {
  DocumentReference ref = _getCollection.doc(uid);
  await ref.delete();
  return ref.id;
}