equalTo method

QueryExpressionJunction<T, InstanceType> equalTo(
  1. T value, {
  2. bool caseSensitive = true,
})

Adds an equality expression to a query.

A query will only return objects where the selected property is equal to value.

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

If value is String, the flag caseSensitive controls whether or not equality is case-sensitively compared.

Example:

  final query = new Query<User>()
    ..where((u) => u.id ).equalTo(1);

Implementation

QueryExpressionJunction<T, InstanceType> equalTo(
  T value, {
  bool caseSensitive = true,
}) {
  if (value is String) {
    expression = StringExpression(
      value,
      PredicateStringOperator.equals,
      caseSensitive: caseSensitive,
      allowSpecialCharacters: false,
    );
  } else {
    expression = ComparisonExpression(value, PredicateOperator.equalTo);
  }

  return _createJunction();
}