get<T> method
Retrieves a single document from the database. Holds a pessimistic lock on the returned document.
docRef
: A reference to the document to retrieve.
Returns a DocumentSnapshot containing the retrieved document.
Throws a FirebaseFirestoreAdminException with FirestoreClientErrorCode.notFound status if no document exists at the
provided docRef
.
Implementation
Future<DocumentSnapshot<T>> get<T>(
DocumentReference<T> docRef,
) async {
if (_writeBatch != null && _writeBatch._operations.isNotEmpty) {
throw Exception(readAfterWriteErrorMsg);
}
return _withLazyStartedTransaction<DocumentReference<T>,
DocumentSnapshot<T>>(
docRef,
resultFn: _getSingleFn,
);
}