buildTextSearchUrl method
String
buildTextSearchUrl({
- required String query,
- Location? location,
- num? radius,
- PriceLevel? minprice,
- PriceLevel? maxprice,
- bool opennow = false,
- String? type,
- String? pagetoken,
- String? language,
- String? region,
Implementation
String buildTextSearchUrl({
required String query,
Location? location,
num? radius,
PriceLevel? minprice,
PriceLevel? maxprice,
bool opennow = false,
String? type,
String? pagetoken,
String? language,
String? region,
}) {
final params = <String, String>{
'query': query,
};
if (minprice != null) {
params['minprice'] = minprice.index.toString();
}
if (maxprice != null) {
params['maxprice'] = maxprice.index.toString();
}
if (opennow) {
params['opennow'] = opennow.toString();
}
if (type != null) {
params['type'] = type;
}
if (pagetoken != null) {
params['pagetoken'] = pagetoken;
}
if (language != null) {
params['language'] = language;
}
if (region != null) {
params['region'] = region;
}
if (location != null) {
params['location'] = location.toString();
}
if (radius != null) {
params['radius'] = radius.toString();
}
if (apiKey != null) {
params['key'] = apiKey!;
}
return url
.replace(
path: '${url.path}$_textSearchUrl',
queryParameters: params,
)
.toString();
}