get method

Future<Snapshot> get (
  1. {Schema schema,
  2. Reach reach}
)

Returns the current snapshot.

Optional parameter reach can be used to specify the minimum level of authority needed. For example:

  • Reach.local tells that a locally cached snapshot is sufficient.
  • Reach.global tells that the snapshot must be from the global transactional database, reflecting the latest state.

An example:

final document = database.collection('recipe').document('tiramisu');
final snapshot = await document.get(
  schema: recipeSchema,
  reach: Reach.regional,
);

Implementation

Future<Snapshot> get({
  Schema schema,
  Reach reach,
}) {
  return getIncrementally(
    schema: schema,
    reach: reach,
  ).last;
}