contains method

QueryPredicateOperation contains(
  1. String value
)

A contains operation.

Matches models where the given field contains the provided value.

This operation can be applied to fields of type String or List

Example:

// returns all blogs that have "foo" in the name
//
// In this example, `Blog.name` is of type String.
Amplify.DataStore.query(
  Blog.classType,
  where: Blog.NAME.contains('foo'),
);

// returns all blogs that have "bar" as one of the categories.
//
// In this example, `Blog.categories` is of type List<String>.
Amplify.DataStore.query(
  Blog.classType,
  where: Blog.CATEGORIES.contains('bar'),
);

Implementation

QueryPredicateOperation contains(String value) => QueryPredicateOperation(
      fieldName,
      ContainsQueryOperator(value),
    );