Repository navigation
Description
Use case
So Clustering in Google map is just landed but we don't have any support for custom cluster icon. There are some package on pub.dev but they are not proper solution to the problem.
Proposal
Need some properties that can override default cluster marker.
Like this
https://developers.google.com/maps/documentation/android-sdk/utility/marker-clustering
The ClusterManager constructor creates a DefaultClusterRenderer and a NonHierarchicalDistanceBasedAlgorithm. You can change the ClusterRenderer and the Algorithm using the setAlgorithm(Algorithm algorithm) and setRenderer(ClusterRenderer view) methods of ClusterManager.
You can implement ClusterRenderer to customize the rendering of the clusters. DefaultClusterRenderer provides a good base to start from. By subclassing DefaultClusterRenderer, you can override the defaults.
Activity
stuartmorgan-g commentedon Aug 9, 2024
It looks like this is not going to be implementable without https://issuetracker.google.com/issues/140415468 (or, alternately, #150525), since the cluster renderer protocol requires a synchronous response. Usually when we have something that requires a synchronous response we pre-generated the necessary information, send it asynchronously, and store it on the platform thread for immediate response, but there's no way to pre-generate all possible images.
Even if clients didn't want the ability to change the icon dynamically (which they well might), they will almost certainly want to add a number, and that can be arbitrary as well.
stuartmorgan-g commentedon Aug 9, 2024
Please use a thumbs-up reaction on this comment specifically (in addition to the original feature request) if the following limited version of this feature would address your use case:
We could potentially implement an API that allowed pre-providing a map of
{cluster count, image bitmap}cluster options, and have the cluster icon picked by finding the image in that map whose cluster count is the largest value that is <= the actual count. For instance, if someone provided{1: imageA, 10: imageB, 50: imageC, 100: imageD}, then any clusters of size 1-9 would use imageA, 10-49 would use imageB, 50-99 would use imageC, and anything larger would use imageD.Rishyash commentedon Aug 13, 2024
@stuartmorgan Needed one suggestion for this as I am not a native developer, what if I fork this package and add custom cluster logic for my usecase on native side code will this reflect on the flutter side map view?
PauloAlves311 commentedon Oct 11, 2024
I'm really happy that there is now official support for clustering, but the inability to alter the clusterOptions leaves it unusable in my opinion. Specially with custom map styles, the variety of colors makes it look really out of place. But let's be honest, green, red, blue, brown... Even without a custom map style, these colors look awful when put together, I can't believe any dev that cares about design would use these clusters as it is.
The clusterIcons also look too big in my personal opinion, so it would be nice to be able to adjust their scaling.
I am really not familiar with the limitations to implement this, but ideally there would be an example of the default renderer which would allow us to tweak all the details. As I can in js or with Fluster, but until then I really don't think I can use the official clustering.
lucavenir commentedon Oct 17, 2024
14 remaining items
andynvt commentedon May 19, 2025
dimonkomaron commentedon May 22, 2025
@stuartmorgan-g Looks like it was implemented in newest Flutter version and customised clusters can be implemented, or are there any other obstacles?
stuartmorgan-g commentedon May 22, 2025
Plugins code cannot rely on thread merging while there is an application-level opt-out for it, because they have no way of knowing what mode they will be running in.
matthew-niemann commentedon May 23, 2025
Dzivo commentedon Jun 5, 2025
Can we start with at lease color change ? Then move to custom elements later ?
Dzivo commentedon Jun 27, 2025
[-]Add support for custom cluster icon in Google Map Flutter[/-][+][google_maps_flutter] Add support for custom cluster icon[/+]Coinners commentedon Oct 10, 2025
vanlooverenkoen commentedon Nov 29, 2025
https://pub.dev/packages/google_maps_cluster_manager
Already supports adding a custom icon to a cluster. Maybe we can take some inspiration from there?
zombie6888 commentedon Nov 29, 2025
I think that's a bad idea. I tried this package. it creates cluster from markers, there's no animation and code becomes more complicated. I think, it should be done on native side as google supports it
Efebzkurt commentedon Oct 13, 2026
Is https://pub.dev/packages/cluster_marker_style what you are looking for?