greaterThan method Null safety

void greaterThan(
  1. String field,
  2. dynamic value
)

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

Supports the following data types:

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

Implementation

void greaterThan(String field, dynamic value) {
  if (field.isEmpty) {
    throw FormatException('field cannot be an empty string.', field);
  }
  if (value == null) {
    throw FormatException('value cannot be null.', value);
  }
  if (!(value is int || value is double || value is String)) {
    throw FormatException('value should be int, double or String.', value);
  }
  _queryElements.add(
    <String, dynamic>{
      _QueryConstants.FIELD: field,
      _QueryConstants.OPERATION: _QueryConstants.GREATER_THAN,
      _QueryConstants.VALUE: value,
    },
  );
}