get method

Future<DocumentSnapshot<T>> get(
  1. [GetOptions? options,
  2. dynamic transObj]
)

Gets the document snapshot.

Parameters:

  • options: Optional get options.
  • transObj: Optional transaction object.

Returns: A Future that resolves to the DocumentSnapshot.

Example:

var snapshot = await docRef.get();

Implementation

Future<DocumentSnapshot<T>> get([
  GetOptions? options,
  dynamic transObj,
]) async {
  FusabaseAuth auth = FusabaseAuth.instanceFor(app: this._oracledb.app);
  String? accessToken = await getAccessToken(auth);
  if (transObj == null) {
    transObj = {"name": "", "start": 0, "end": 0};
  }
  ;

  Map<String, dynamic> result;
  try {
    result = await _helper.get(
      createClient(_oracledb.app),
      options,
      this,
      __logLevel,
      accessToken,
      transObj,
    );
  } catch (e) {
    return DocumentSnapshot<T>(
      {"DOCUMENT": null, "OID": this._id, "VERSION": 0},
      this,
      SnapshotMetadata(hasPendingWrites: false, isFromCache: false),
      null,
    ); // If Path doesn't exist Check it..
  }
  if (result["ret"].length == 0) {
    return DocumentSnapshot<T>(
      {"DOCUMENT": null, "OID": this._id, "VERSION": 0},
      this,
      SnapshotMetadata(hasPendingWrites: false, isFromCache: false),
      null,
    );
  }

  return DocumentSnapshot<T>(
    result["ret"][0]["osons"],
    this,
    SnapshotMetadata(hasPendingWrites: false, isFromCache: false),
    result["ret"][0]["brid"],
  ); // If Path doesn't exist Check it..
}