buildPhotoUrl method
Implementation
String buildPhotoUrl({
required String photoReference,
int? maxWidth,
int? maxHeight,
}) {
if (maxWidth == null && maxHeight == null) {
throw ArgumentError("You must supply 'maxWidth' or 'maxHeight'");
}
final params = <String, String>{
'photoreference': photoReference,
};
if (maxWidth != null) {
params['maxwidth'] = maxWidth.toString();
}
if (maxHeight != null) {
params['maxheight'] = maxHeight.toString();
}
if (apiKey != null) {
params['key'] = apiKey!;
}
return url
.replace(
path: '${url.path}$_photoUrl',
queryParameters: params,
)
.toString();
}