I'm haunted by a weird bug where after I update my items list, the initial new clusters are being updated but when zooming in, they aren't being unfolded anymore. They basically stay there until I again update the list.
So I digged into your code and found the forceUpdate setting, which seems to work. I'm not sure how performance intense this is but it's the only way to make it work.
Part of the widget
@override
Widget build(BuildContext context) {
_ctx = context;
return new StoreConnector<AppState, AppState>(
onInit: (store) {
// Set cluster items
_items = store.state.companies.map((e) => ClusterItem(LatLng(e.lat, e.lon), item: e)).toList();
// Set the manager
_manager = ClusterManager<Company>(
_items,
_updateMarkers,
markerBuilder: _markerBuilder,
levels: [1, 3, 5, 7, 9, 12, 13, 15, 17, 20],
initialZoom: _currentZoom,
);
},
onDidChange: (state) {
// Pass new companies as items to manager
_updateItems(state.companies); // <----------------
},
);
}
Hi, thanks for your effort.
I'm haunted by a weird bug where after I update my items list, the initial new clusters are being updated but when zooming in, they aren't being unfolded anymore. They basically stay there until I again update the list.
So I digged into your code and found the
forceUpdate
setting, which seems to work. I'm not sure how performance intense this is but it's the only way to make it work.Part of the widget
Update Items function
Widget build part /w map