beginsWith method

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

Adds a 'begins with string' expression to a query.

A query will only return objects where the selected property is begins with the string value.

This method can be used on String types. The flag caseSensitive controls whether strings are compared case-sensitively.

Example:

  var query = new Query<Employee>()
    ..where((s) => s.name).beginsWith("B");

Implementation

QueryExpressionJunction<T, InstanceType> beginsWith(
  String value, {
  bool caseSensitive = true,
}) {
  expression = StringExpression(
    value,
    PredicateStringOperator.beginsWith,
    caseSensitive: caseSensitive,
    allowSpecialCharacters: false,
  );

  return _createJunction();
}