whereStartsWith method

void whereStartsWith(
  1. String column,
  2. String prefix, {
  3. bool caseSensitive = false,
})

Add a constraint for finding objects where the String value in column starts with prefix

Implementation

void whereStartsWith(
  String column,
  String prefix, {
  bool caseSensitive = false,
}) {
  prefix = Uri.encodeComponent(prefix);

  if (caseSensitive) {
    queries.add(MapEntry<String, dynamic>(
        _singleQuery, '"$column":{"\$regex": "^$prefix"}'));
  } else {
    queries.add(MapEntry<String, dynamic>(
        _singleQuery, '"$column":{"\$regex": "^$prefix", "\$options": "i"}'));
  }
}