Clustering Support in Google Map Flutter 2024

Mohit Gupta
Stackademic
Published in
2 min readAug 8, 2024

The much-anticipated clustering feature in Google Maps Flutter is finally live! On August 7th, the pull request was merged into the main branch, introducing the clustering functionality in version 2.9.0 of the google_maps_flutter package.

So to add clustering in marker we just need to add clusterManagerId property in Marker.

Adding Full Source code below-

import 'dart:math';
import 'package:flutter/material.dart';
import 'package:google_maps_flutter/google_maps_flutter.dart';


GlobalKey<NavigatorState>? navigatorKey;

Future<void> main() async {
WidgetsFlutterBinding.ensureInitialized();
runApp(const MyApp());
}

class MyApp extends StatelessWidget {
const MyApp({Key? key,}) : super(key: key);

@override
Widget build(BuildContext context) {
return MaterialApp(
navigatorKey: navigatorKey,
debugShowCheckedModeBanner: false,
home: const GoogleMapClustering(),
);
}
}

class GoogleMapClustering extends StatefulWidget {
const GoogleMapClustering({super.key});

@override
State<StatefulWidget> createState() => GoogleMapClusteringState();
}

class GoogleMapClusteringState extends State<GoogleMapClustering> {…

Create an account to read the full story.

The author made this story available to Medium members only.
If you’re new to Medium, create a new account to read this story on us.

Or, continue in mobile web

Already have an account? Sign in

Flutter Developer | Wheelseye Technology