Skip to content
pubscout

flutter_map_supercluster

4.3.0, released 3 years ago by balanci.ng

Very fast marker clustering for flutter_map.

WASM-ready
$ flutter pub add flutter_map_supercluster
Source repository

What it does

Provides marker clustering layers for flutter_map to efficiently display large numbers of markers. It offers both immutable and mutable clustering layers depending on whether markers need to be added or removed dynamically.

AI-written summary of version 4.3.0, based on the package's README and metadata. Report an inaccuracy

Use it when

  • You are using flutter_map and experiencing performance issues with many markers.
  • You want to cluster markers efficiently without heavy animations.

Skip it when

  • You require built-in beautiful clustering animations out of the box.
  • You are not using flutter_map.

Strengths

  • Extremely fast marker clustering performance.
  • Supports both mutable and immutable marker layers.

Weaknesses

  • Does not include built-in clustering animations.

Setup

Kind
Flutter widgets
Effort
Low
Code generation
No
Direct dependencies
7
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,
        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),
              ),
            ),
          );
        },
      ),
    ],
  );
}

Alternatives

Packages that do the same job and could replace flutter_map_supercluster.

Works with

Packages commonly used together with flutter_map_supercluster: ones it builds on, ones built on it, and its own family.