Search code examples
flutterhere-api

How to show current location indication


I'm using the Flutter SDK Version 4.3.1.0.

I get my location updates from the geolocator plugin and want to show the location on the HERE map. It correctly centers the map to the current location but there is no location indicator.

I currently use the following code. What else do I need?

void _showPosition(final GeoCoordinates coordinates) {
  _mapView.mapScene.loadSceneForMapScheme(MapScheme.greyDay, (MapError error) {
    if (error != null) {
      print("Map scene not loaded. MapError: " + error.toString());
      return;
    }

    _mapView.camera.lookAtPointWithDistance(coordinates, 1000);
  });
}

I'm using the Flutter Channel beta, v1.17.0-3.4.pre


Solution

  • The HERE SDK for Flutter does not contain a pre-configured location indicator. You can easily create one by adding a circle item onto the map:

    For this I would recommend using a MapPolygon that contains a GeoCircle shape. You can then also update the radius of the GeoCircle on the fly to indicate the current horizontal accuracy of the geolocator plugin.