markers_cluster_google_maps_flutter 0.0.1
markers_cluster_google_maps_flutter: ^0.0.1 copied to clipboard
Package for clustering markers on Google Maps in Flutter applications
markers_cluster_google_maps_flutter #
A flutter package for clustering the markers on google maps flutter.
Installation #
To use this plugin, add markers_cluster_google_maps_flutter as a dependency in your pubspec.yaml file.
Usage #
- Import the package with:
import 'package:markers_cluster_google_maps_flutter/markers_cluster_google_maps_flutter.dart';
- Initialize the MarkersClusterManager:
final clusterManager = MarkersClusterManager();
- Add markers using following method:
clusterManager.addMarker()
- Update clusters at a specific zoom level:
await clusterManager.updateClusters(zoomLevel: 12);
- Get the clustered markers with following method
final clusteredMarkers = clusterManager.getClusteredMarkers();
- Use the clustered markers in your GoogleMap widget:
GoogleMap(
mapType: MapType.normal,
onMapCreated: (GoogleMapController controller) {
// Complete controller and update clusters
},
initialCameraPosition: CameraPosition(
target: LatLng(33.6937, 73.0653),
zoom: 10.0,
),
onCameraMove: (CameraPosition position) {
// Update clusters based on zoom level
},
markers: Set<Marker>.of(clusteredMarkers),
);
Support and Contribute #
For support, please star on Github repository. Contributions are welcome! Please submit issues and pull requests on the GitHub repository.