notEqualTo method Null safety

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

Adds a 'not equal' expression to a query.

A query will only return objects where the selected property is not 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<Employee>()
    ..where((e) => e.id).notEqualTo(60000);

Implementation

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

  return _createJunction();
}