Search code examples
fluttermapboxgeocoding

flutter place marker on tap with mapbox


I scoured the web, and found no answer specifically for that question for Mapbox and flutter. I do not have much code, just looking for something.


Solution

  • so flutter's flutter_map plugin actually has an onTap function in MapOptions that gives you the location that you tap:

    FlutterMap(
      options: MapOptions(
        onTap: (position, latLng) {
         // add marker at latLng.latitude and latLng.longitude
      }
    )
    )
    

    Then add a marker at the given point.