exists method

Future<bool> exists(
  1. {Reach reach = Reach.regional}
)

Tells whether the document exists.

An example:

final document = database.collection('recipe').document('tiramisu');
final exists = await document.exists(reach:Reach.regional);

Implementation

Future<bool> exists({
  Reach reach = Reach.regional,
}) async {
  final snapshot = await get(
    schema: MapSchema(const {}),
    reach: reach,
  );
  return snapshot.exists;
}