beginsWith method Null safety

void beginsWith(
  1. String field,
  2. String value
)

You can invoke this method to add a query condition in which the value of a field of the String or Text type in an entity class starts with a specified substring.

Supports the following data types:

  • String for String, and Text.

Implementation

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