oneOf method

QueryExpressionJunction<T, InstanceType> oneOf(
  1. Iterable<T> values
)

Adds a 'equal to one of' expression to a query.

A query will only return objects where the selected property is equal to one of the values.

This method can be used on String, int, double, bool and DateTime types.

Example:

  var query = new Query<Employee>()
    ..where((e) => e.department).oneOf(["Engineering", "HR"]);

Implementation

QueryExpressionJunction<T, InstanceType> oneOf(Iterable<T> values) {
  if (values.isEmpty) {
    throw ArgumentError(
        "'Query.where.oneOf' cannot be the empty set or null.");
  }
  expression = SetMembershipExpression(values.toList());

  return _createJunction();
}