get method

Future<D?> get({
  1. GetOptions? options,
  2. Transaction? transaction,
})

options doesn't work with transaction

Implementation

Future<D?> get({
  GetOptions? options,
  Transaction? transaction,
}) async {
  final snapshot =
      await (transaction == null ? ref.get(options) : transaction.get(ref));
  if (firestoreOperationCounter.enabled) {
    firestoreOperationCounter.recordRead(
      isFromCache: snapshot.metadata.isFromCache,
    );
  }
  if (!snapshot.exists) {
    logger.warning('$D not found(id: ${ref.id})');
    return Future.value();
  }
  return collectionRef.decode(
    snapshot,
    this,
  );
}