Reputation: 1117
I am trying to show a flutter_map with more than 12k marker and debuging I figure out that every time I move the map it rebuild all marker within bound of the map, have any way to cache the Widget of each Marker, I had tried store in a Map but its very slow, if I create all as const
I got better performance, but in my case I need user a GetureDetector
and I can't create a const because of params.
And yes I need show all markers at once.
Upvotes: 0
Views: 639
Reputation: 1638
First, I would ask you to reconsider your application design. I'm not sure what the purpose of showing 12k markers simultaneously would be. FM culls markers that are outside the camera, so these markers must be very close together, or the map must be very zoomed out. If you could share a little more info about what you are trying to do, that might be helpful. If you don't want to share that here, feel free to join the Discord server.
Unless it is absolutely vital, or the markers are extremely simple, you should not be displaying them all at once. Have a look at the clustering plugins, there's a wide variety available. Trying to move 12k widget trees a frame can be fairly expensive, as you might imagine, especially if the widget trees are not simple.
You can try showing different subsets of them dependent on zoom level.
If you must try to persist with showing them all at once, maybe https://github.com/jesussmile/markerx is of interest, but it might be very outdated and not maintained.
One more tip, if you're running on web, remember to force the use of the CanvasKit renderer.
Upvotes: 2