flutter_map_supercluster 5.0.0-dev.1 copy "flutter_map_supercluster: ^5.0.0-dev.1" to clipboard
flutter_map_supercluster: ^5.0.0-dev.1 copied to clipboard

Very fast Marker clustering for flutter_map. Supports efficient adding/removing of Markers.

Flutter Map Supercluster #

Two different Marker clustering layers for flutter_map:

  • SuperclusterLayer.immutable: An extremely fast Marker clustering layer, Markers may not be added/removed.
  • SuperclusterLayer.mutable: A slightly slower (but still very fast) Marker clustering layer. Markers can be added/removed.

Example

Usage #

Add flutter_map and flutter_map_supercluster to your pubspec:

dependencies:
  flutter_map: any
  flutter_map_supercluster: any # or the latest version on Pub

Add it to FlutterMap:

  Widget build(BuildContext context) {
  return FlutterMap(
    options: MapOptions(
      zoom: 5,
      maxZoom: 15,
    ),
    children: <Widget>[
      TileLayer(
        options: TileLayerOptions(
          urlTemplate: 'https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png',
          subdomains: ['a', 'b', 'c'],
        ),
      ),
      SuperclusterLayer.immutable(
        initialMarkers: markers, // Provide your own
        clusterWidgetSize: const Size(40, 40),
        builder: (context, markerCount, extraClusterData) {
          return Container(
            decoration: BoxDecoration(
              borderRadius: BorderRadius.circular(20.0),
              color: Colors.blue,
            ),
            child: Center(
              child: Text(
                markerCount.toString(),
                style: const TextStyle(color: Colors.white),
              ),
            ),
          );
        },
      ),
    ],
  );
}

Run the example #

See the example/ folder for a working example app which demonstrates both immutable and mutable cluster layers.

20
likes
140
pub points
90%
popularity

Publisher

verified publisherbalanci.ng

Very fast Marker clustering for flutter_map. Supports efficient adding/removing of Markers.

Repository (GitHub)
View/report issues

Topics

#flutter-map #cluster

Documentation

API reference

License

BSD-3-Clause (license)

Dependencies

async, equatable, flutter, flutter_map, flutter_map_marker_popup, latlong2, provider, supercluster

More

Packages that depend on flutter_map_supercluster