Flutter_map: update marker Lat Lng

Created on 18 Dec 2018  路  6Comments  路  Source: fleaflet/flutter_map

I couldn't find a way to update marker Lat Lng is there any way that can update marker location?

Most helpful comment

@vblago I think it is not a best practice to remove and recreate a marker just for a simple position change

All 6 comments

You can remove this marker and add a new one. Marker is added by changing the list of marker layer options and state changing after that.

Yes you have to remove and recreate it, this widget does not provide the update method

@vblago I think it is not a best practice to remove and recreate a marker just for a simple position change

It would be good to add all the animate marker leaflet functions

You can remove this marker and add a new one. Marker is added by changing the list of marker layer options and state changing after that.

When I marker.add(new Marker) and then set state, I get the map reloading again. Surely there is a way to move marker location without refreshing the map?

@rubberbird a moving_markers example page has been added. Please take a look and see if that works for your use case, thanks for the feedback!
https://github.com/johnpryan/flutter_map/commit/117f1797589bdcceb8d3c49e60c5d0ee262225fa

Was this page helpful?
0 / 5 - 0 ratings