get<T extends Object?> method

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

Reads the document referred to by documentRef.

Implementation

Future<DocumentSnapshot<T>> get<T extends Object?>(
  DocumentReference<T> documentRef,
) async {
  _firestore.validateReference(documentRef);
  final List<MaybeDocument> result = await _transaction.lookup(<DocumentKey>[
    documentRef.key,
  ]);
  if (result.length != 1) {
    throw fail('Mismatch in docs returned from document lookup.');
  }
  final MaybeDocument doc = result.first;
  return DocumentSnapshot<T>(
    _firestore,
    documentRef.key,
    doc is Document ? doc : null,
    documentRef.converter,
  );
}