Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

requestMyLocationLatLng() throws Type error #372

Open
ivanesi opened this issue Jan 18, 2024 · 2 comments
Open

requestMyLocationLatLng() throws Type error #372

ivanesi opened this issue Jan 18, 2024 · 2 comments
Labels
bug Something isn't working good first issue Good for newcomers

Comments

@ivanesi
Copy link

ivanesi commented Jan 18, 2024

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.

@ivanesi ivanesi changed the title Type error requestMyLocationLatLng() throws Type error Jan 18, 2024
@m0nac0
Copy link
Collaborator

m0nac0 commented Jan 18, 2024

Do you display the user's location on the map?

@m0nac0
Copy link
Collaborator

m0nac0 commented Jan 18, 2024

Seems like we should also modify

final Map<dynamic, dynamic> reply = await _channel.invokeMethod(
by first checking if result != null && result is Map<dynamic, dynamic> and if that is not fulfilled, return null.

@m0nac0 m0nac0 added the good first issue Good for newcomers label Jan 18, 2024
@josxha josxha added the bug Something isn't working label May 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

3 participants