Skip to content

Conversation

@elitree
Copy link
Contributor

@elitree elitree commented Feb 1, 2026

Note: this PR attempts to use the same strategy from the Google Maps Flutter Web PR #10562 and apply it to Google Maps Flutter Android.

Summary

  • Adds batch addItems() and removeItems() methods to ClusterManagersController
  • Refactors MarkersController to batch add/remove/change operations for clustered markers
  • Reduces redundant re-clustering calls when multiple markers are added/removed/changed at once

This improves performance when working with large numbers of clustered markers by calling ClusterManager.cluster() once per cluster manager instead of once per marker.

Test plan

  • Added unit tests for batch add/remove operations
  • Added unit test for batch cluster manager changes
  • Existing tests pass

Addresses flutter/flutter#170573

Pre-Review Checklist

If you need help, consider asking for advice on the #hackers-new channel on Discord.

Note: The Flutter team is currently trialing the use of Gemini Code Assist for GitHub. Comments from the gemini-code-assist bot should not be taken as authoritative feedback from the Flutter team. If you find its comments useful you can update your code accordingly, but if you are unsure or disagree with the feedback, please feel free to wait for a Flutter team member's review for guidance on which automated comments should be addressed.

🤖 Generated with Claude Code

Footnotes

  1. Regular contributors who have demonstrated familiarity with the repository guidelines only need to comment if the PR is not auto-exempted by repo tooling. 2 3

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces batch operations for clustered markers to improve performance, which is a great enhancement. The changes involve adding addItems() and removeItems() methods to ClusterManagersController and refactoring MarkersController to group marker operations by cluster manager and execute them in batches. The new logic is well-tested with new unit tests. My review includes a few suggestions to use Map.computeIfAbsent in MarkersController for more concise and modern Java code.

@elitree elitree force-pushed the batch-marker-cluster-android branch from 22e3623 to 22037dc Compare February 2, 2026 00:24
@stuartmorgan-g stuartmorgan-g added the triage-android Should be looked at in Android triage label Feb 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants