get<T extends Object?> method

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

Gets a document within the transaction.

Parameters:

  • docRef: The document reference.

Returns: A Future with the DocumentSnapshot.

Example:

var doc = await transaction.get(docRef);

Implementation

Future<DocumentSnapshot<T>> get<T extends Object?>(
    DocumentReference<T> docRef) async {
  if (__status == -1) {
    throw Utils.oracledbErrorHandler(400, OracledbErrorMessages.transactionEnded, null);
  }

  dynamic transObj = {"name": __name, "start": 1 - __status, "end": 0};
  if (__status == 0) {
    __status = 1;
  }
  __operations.add(
      {"method": "get", "docRef": docRef, "data": null, "options": null, "version":null});
  GetOptions op = GetOptions();
  dynamic res = await docRef.get(op, transObj);
  __versions[docRef.path] = res.version;
  return res;
}