zyzdev / flutter_street_view

10 stars 29 forks source link

[flutter_google_street_view] There is no callback to know if the street view is not available for a location. #2

Closed skyloovportal closed 2 years ago

skyloovportal commented 2 years ago

Hey, I really appreciate your efforts but i would like to request for an update i.e If there is no street view available for a specific location please provide a callback in platform view in order to show a valid response to the user.

Thanks

zyzdev commented 2 years ago

Hi, @skyloovportal Callback onPanoramaChangeListener can solve it. onPanoramaChangeListener callback function is void Function(StreetViewPanoramaLocation? location, Exception? e){} and the Exception? e will not be null while the street view invalid. Try the code shown below.

const LatLng INVALID = LatLng(-45.125783, 151.276417);

FlutterGoogleStreetView(
  initPos: INVALID,
  onPanoramaChangeListener: (location, e) {
    print("location:$location, e:$e");
  },
);

//log location:null, e:Exception: Oops..., no valid panorama found with position:-45.125783, 151.27641700000004, try to change position, radius or source.

zyzdev commented 2 years ago

Close this issue here. The callback onPanoramaChangeListener will receive exception while the street view invalid. See demo Street View Panorama events(demo/street_view_panorama_events.dart) in example for usage.