whereContains method

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

Add a constraint for finding String values that contain the provided substring

Implementation

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

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