Skip to content

[google_maps_flutter] Add support for custom cluster icon #153092

Open

Description

@Mohit8G

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

  1. added
    in triagePresently being triaged by the triage team
    c: new featureNothing broken; request for a new capability
    p: mapsGoogle Maps plugin
    packageflutter/packages repository. See also p: labels.
    c: proposalA detailed proposal for a change to Flutter
    and removed
    in triagePresently being triaged by the triage team
    on Aug 9, 2024
  2. stuartmorgan-g commented on Aug 9, 2024

    @stuartmorgan-g
    Contributor

    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.

  3. stuartmorgan-g commented on Aug 9, 2024

    @stuartmorgan-g
    Contributor

    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.

  4. added
    P3Issues that are less important to the Flutter project
    on Aug 9, 2024
  5. Rishyash commented on Aug 13, 2024

    @Rishyash

    @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?

  6. PauloAlves311 commented on Oct 11, 2024

    @PauloAlves311

    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.

  7. lucavenir commented on Oct 17, 2024

    @lucavenir
  8. 14 remaining items

  9. andynvt commented on May 19, 2025

    @andynvt
  10. dimonkomaron commented on May 22, 2025

    @dimonkomaron

    #150525

    @stuartmorgan-g Looks like it was implemented in newest Flutter version and customised clusters can be implemented, or are there any other obstacles?

  11. stuartmorgan-g commented on May 22, 2025

    @stuartmorgan-g
    Contributor

    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.

  12. matthew-niemann commented on May 23, 2025

    @matthew-niemann
  13. Dzivo commented on Jun 5, 2025

    @Dzivo

    Can we start with at lease color change ? Then move to custom elements later ?

  14. Dzivo commented on Jun 27, 2025

    @Dzivo
  15. changed the title [-]Add support for custom cluster icon in Google Map Flutter[/-] [+][google_maps_flutter] Add support for custom cluster icon[/+] on Jul 29, 2025
  16. Coinners commented on Oct 10, 2025

    @Coinners
  17. added
    👍Issue needs retriaging to evaluate its popularity
    and removed on Nov 19, 2025
  18. removed
    👍Issue needs retriaging to evaluate its popularity
    on Nov 19, 2025
  19. vanlooverenkoen commented on Nov 29, 2025

    @vanlooverenkoen
    Contributor

    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?

  20. zombie6888 commented on Nov 29, 2025

    @zombie6888

    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?

    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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3Issues that are less important to the Flutter projectc: new featureNothing broken; request for a new capabilityp: mapsGoogle Maps pluginpackageflutter/packages repository. See also p: labels.team-ecosystemOwned by Ecosystem teamtriaged-ecosystemTriaged by Ecosystem team

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions