contains method Null safety

void contains(
  1. String field,
  2. String value

You can invoke this method to add a query condition in which the value of a field in an entity class contains a specified substring.

Supports the following data types:

  • String for String, and Text.


void contains(String field, String value) {
  if (field.isEmpty) {
    throw FormatException('field cannot be an empty string.', field);
    <String, dynamic>{
      _QueryConstants.FIELD: field,
      _QueryConstants.OPERATION: _QueryConstants.CONTAINS,
      _QueryConstants.VALUE: value,