Query.where constructor

Query.where(
  1. String evaluatedField,
  2. dynamic value, {
  3. Compare? compare,
  4. bool limit1 = false,
})

Make a very simple query with a single Where statement. For example Query.where('id', 1).

limit1 adds a limit param when true. Defaults to false.

Implementation

factory Query.where(
  String evaluatedField,
  dynamic value, {
  Compare? compare,
  bool limit1 = false,
}) {
  compare ??= Where.defaults.compare;
  return Query(
    where: [Where(evaluatedField, value: value, compare: compare)],
    providerArgs: {
      if (limit1) 'limit': 1,
    },
  );
}