get<T extends Object?> method

Future<DocumentSnapshot<T>> get<T extends Object?>(
  1. DocumentReference<T> documentReference
)

Reads the document referenced by the provided DocumentReference.

If the document changes whilst the transaction is in progress, it will be re-tried up to five times.

Implementation

Future<DocumentSnapshot<T>> get<T extends Object?>(
  DocumentReference<T> documentReference,
) async {
  DocumentSnapshotPlatform documentSnapshotPlatform =
      await _delegate.get(documentReference.path);

  final snapshot =
      _JsonDocumentSnapshot(_firestore, documentSnapshotPlatform);

  if (snapshot is DocumentSnapshot<T>) {
    return snapshot as DocumentSnapshot<T>;
  }

  final withConverterDocRef =
      documentReference as _WithConverterDocumentReference<T>;

  return _WithConverterDocumentSnapshot<T>(
    snapshot,
    withConverterDocRef._fromFirestore,
    withConverterDocRef._toFirestore,
  );
}