PlaceAutocompleteRequestOptions constructor

PlaceAutocompleteRequestOptions({
  1. List<String>? components,
  2. String? language,
  3. LatLng? location,
  4. int? offset,
  5. LatLng? origin,
  6. double? radius,
  7. String? region,
  8. String? sessiontoken,
  9. bool? strictbounds,
  10. List<String>? types,
})

Implementation

PlaceAutocompleteRequestOptions({
  this.components,
  this.language,
  this.location,
  this.offset,
  this.origin,
  this.radius,
  this.region,
  this.sessiontoken,
  this.strictbounds,
  this.types,
}) {
  if (offset != null && offset! < 0) {
    throw ArgumentError('Offset cannot be negative');
  }
  if (radius != null && radius! <= 0) {
    throw ArgumentError('Radius must be greater than zero');
  }
  if (components != null && components!.length > 5) {
    throw ArgumentError('Components cannot contain more than 5 countries');
  }
  if (types != null && types!.length > 5) {
    throw ArgumentError('Types cannot contain more than 5 types');
  }
  if (location != null && radius == null) {
    throw ArgumentError(
        'Radius must be specified when location is specified');
  }
}