Query constructor Null safety

Query(
  1. HopDocClient client,
  2. dynamic index,
  3. Map<String, dynamic> _compoundQuery,
  4. String _field,
  5. {String? isEqualTo,
  6. int? isGreaterThan,
  7. int? isGreaterThanOrEqualTo,
  8. int? isLessThan,
  9. int? isLessThanOrEqualTo,
  10. String? contains,
  11. GeoDistanceQuery? isWithinRadius,
  12. GeoBoxQuery? isWithinBox,
  13. int? at,
  14. Document? after,
  15. int? limit,
  16. String? orderBy,
  17. bool addId = false,
  18. bool nanoDate = false}
)

Implementation

Query(
  HopDocClient client,
  index,
  this._compoundQuery,
  this._field, {
  String? isEqualTo,
  int? isGreaterThan,
  int? isGreaterThanOrEqualTo,
  int? isLessThan,
  int? isLessThanOrEqualTo,
  String? contains,
  GeoDistanceQuery? isWithinRadius,
  GeoBoxQuery? isWithinBox,
  int? at,
  Document? after,
  int? limit,
  String? orderBy,
  this.addId = false,
  this.nanoDate = false,
})  : assert((at == null || after == null) == true,
          "You cannot set both at and after in start filter method on a query"),
      super(client, index) {
  if (isEqualTo != null) {
    this._queryType = QueryType.IS_EQUAL_TO;
    this._value = isEqualTo;
  } else if (isGreaterThan != null) {
    this._queryType = QueryType.IS_GREATER_THAN;
    this._value = isGreaterThan;
  } else if (isGreaterThanOrEqualTo != null) {
    this._queryType = QueryType.IS_GREATER_THAN_OR_EQUAL_TO;
    this._value = isGreaterThanOrEqualTo;
  } else if (isLessThan != null) {
    this._queryType = QueryType.IS_LESS_THAN;
    this._value = isLessThan;
  } else if (isLessThanOrEqualTo != null) {
    this._queryType = QueryType.IS_LESS_THAN_OR_EQUAL_TO;
    this._value = isLessThanOrEqualTo;
  } else if (contains != null) {
    this._queryType = QueryType.CONTAINS;
    this._value = contains;
  } else if (isWithinRadius != null) {
    this._queryType = QueryType.IS_WITHIN_RADIUS;
    this._value = isWithinRadius;
  } else if (isWithinBox != null) {
    this._queryType = QueryType.IS_WITHIN_BOX;
    this._value = isWithinBox;
  } else if (at != null) {
    this._queryType = QueryType.START_AT;
    this._value = at;
  } else if (after != null) {
    this._queryType = QueryType.START_AFTER;
    this._value = after;
  } else if (limit != null) {
    this._queryType = QueryType.LIMIT;
    this._value = limit;
  } else if (orderBy != null) {
    this._queryType = QueryType.ORDER_BY;
    this._value = orderBy;
  }
}