whereIn method Null safety

void whereIn(
  1. String field,
  2. List value

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

Supports the following data types:

  • int for Byte, Short, Integer, Long, and Date array.
  • double for Double, and Float array.
  • String for String, and Text array.


void whereIn(String field, List<dynamic> value) {
  if (field.isEmpty) {
    throw FormatException('field cannot be an empty string.', field);
  if (value.isEmpty) {
    throw FormatException('value cannot be an empty list.', value);
  if (!(value is List<int> ||
      value is List<double> ||
      value is List<String>)) {
    throw FormatException(
        'value should be List<int>, List<double> or List<String>.', value);
    <String, dynamic>{
      _QueryConstants.FIELD: field,
      _QueryConstants.OPERATION: _QueryConstants.IN,
      _QueryConstants.VALUE: value,