fetchPlacePhoto method
Fetches a photo of a place.
Before fetching a place photo the place it self must be fetched,
together with the PlaceField.PhotoMetadatas
field
For more info: https://developers.google.com/maps/documentation/places/android-sdk/photos
Implementation
@override
Future<FetchPlacePhotoResponse> fetchPlacePhoto(
PhotoMetadata photoMetadata, {
int? maxWidth,
int? maxHeight,
}) async {
PlacePhoto? value = _photosCache[photoMetadata.photoReference];
if (value == null) {
throw PlatformException(
code: 'API_ERROR_PHOTO',
message: 'PhotoMetadata must be initially fetched with fetchPlace',
details: '',
);
}
final url = value.url;
return FetchPlacePhotoResponse.imageUrl(url);
}