-
Notifications
You must be signed in to change notification settings - Fork 166
Open
Description
In this function, there is an exception "Null Check operator is use on a null value". It will be better if written like this
if (widget.getPlaceDetailWithLatLng != null) {
widget.getPlaceDetailWithLatLng!(prediction);
}
`Future getPlaceDetailsFromPlaceId(Prediction prediction) async {
//String key = GlobalConfiguration().getString('google_maps_key');
var url =
"https://maps.googleapis.com/maps/api/place/details/json?placeid=${prediction.placeId}&key=${widget.googleAPIKey}";
debugPrint("urll 4 Selected Place : $url");
try {
Response response = await _dio.get(
url,
);
PlaceDetails placeDetails = PlaceDetails.fromJson(response.data);
prediction.lat = placeDetails.result?.geometry?.location?.lat.toString();
prediction.lng = placeDetails.result?.geometry?.location?.lng.toString();
widget.getPlaceDetailWithLatLng!(prediction);
} catch (e) {
var errorHandler = ErrorHandler.internal().handleError(e);
_showSnackBar("${errorHandler.message}");
}
}`
Metadata
Metadata
Assignees
Labels
No labels