buildDetailsUrl method
Implementation
String buildDetailsUrl({
String? placeId,
String? reference,
String? sessionToken,
String? language,
List<String> fields = const [],
String? region,
}) {
if (placeId != null && reference != null) {
throw ArgumentError("You must supply either 'placeid' or 'reference'");
}
final params = <String, String>{};
if (placeId != null) {
params['placeid'] = placeId;
}
if (reference != null) {
params['reference'] = reference;
}
if (language != null) {
params['language'] = language;
}
if (region != null) {
params['region'] = region;
}
if (fields.isNotEmpty) {
params['fields'] = fields.join(',');
}
if (apiKey != null) {
params['key'] = apiKey!;
}
if (sessionToken != null) {
params['sessiontoken'] = sessionToken;
}
return url
.replace(
path: '${url.path}$_detailsSearchUrl',
queryParameters: params,
)
.toString();
}