buildUrl method
Implementation
String buildUrl({
String? address,
Bounds? bounds,
String? language,
String? region,
List<Component> components = const [],
List<String> resultType = const [],
List<String> locationType = const [],
String? placeId,
Location? location,
}) {
final params = <String, String>{};
if (location != null) {
params['latlng'] = location.toString();
}
if (placeId != null) {
params['place_id'] = placeId;
}
if (address != null) {
params['address'] = address;
}
if (bounds != null) {
params['bounds'] = bounds.toString();
}
if (language != null) {
params['language'] = language;
}
if (region != null) {
params['region'] = region;
}
if (components.isNotEmpty) {
params['components'] = components.join('|');
}
if (resultType.isNotEmpty) {
params['result_type'] = resultType.join('|');
}
if (locationType.isNotEmpty) {
params['location_type'] = locationType.join('|');
}
if (apiKey != null) {
params['key'] = apiKey!;
}
return url.replace(queryParameters: params).toString();
}