flutter-maplibre-gl
flutter-maplibre-gl copied to clipboard
requestMyLocationLatLng() throws Type error
On iOS I got exception:
type 'Null' is not a subtype of type 'Map<dynamic, dynamic>'
when call controller.requestMyLocationLatLng()
:
#0 MethodChannelMaplibreGl.requestMyLocationLatLng (package:maplibre_gl_platform_interface/src/method_channel_maplibre_gl.dart:342:35)
<asynchronous suspension>
Future<void> onMapCreated(MaplibreMapController controller) async {
try {
final granted = await context.read<MapCubit>().requestLocationPermission();
if (granted) {
final latLng = await controller.requestMyLocationLatLng();
_logger.trace(latLng);
}
} catch (e, st) {
_logger.error(e, st);
}
}
On Android request freeze and no log output after it.
Do you display the user's location on the map?
Seems like we should also modify https://github.com/maplibre/flutter-maplibre-gl/blob/acb428a005efd9832a0a8e7ef0945f899dfb3ca5/maplibre_gl_platform_interface/lib/src/method_channel_maplibre_gl.dart#L342 by first checking if result != null && result is Map<dynamic, dynamic>
and if that is not fulfilled, return null.