clustering_google_maps 0.0.1+2

  • Example
  • Installing
  • Versions
  • new48

Clustering for Flutter Google Maps #

pub package

A Flutter package that recreate clustering technique in a Google Maps widget.

Developers Preview Status #

The package recreate the CLUSTERING technique in a Google Maps. It's work with data recordered in a dababase SQLite. I use sqflite

Usage #

To use this package, add clustering_google_maps as a dependency in your pubspec.yaml file.

For a better performance, at every zoom variation on the map, the package performs a specific query on the SQLite database. This solution is better than loading all points in memory (in a list) and then aggregating points on the map.

Getting Started #

For the package to work properly, you must have the data of the points saved in a SQLite database. Latitude, longitude and the string of geohash. These three parameters are necessary for correct operation. If you have not saved the GEOHASH, I suggest you install GEOHASH plugin and save the value of Geohash in the points table of db.

Future Implementations #

  • To further improve performance I am creating a way to perform sql queries only on the latlng bounding box displayed on the map.
  • I will insert custom marker with number of points. But for now Google Maps widget does not allow custom widget from dart but only static Bitmap

Quick Example #

import 'package:example/app_db.dart';
import 'package:example/fake_point.dart';
import 'package:flutter/material.dart';
import 'package:google_maps_flutter/google_maps_flutter.dart';
import 'package:sqflite/sqflite.dart';
import 'package:clustering_google_maps/clustering_google_maps.dart';

class HomeScreen extends StatefulWidget {
  HomeScreen({Key key}) : super(key: key);

  _HomeScreenState createState() => _HomeScreenState();

class _HomeScreenState extends State<HomeScreen> {
  final CameraPosition initialCameraPosition =
      CameraPosition(target: LatLng(42.825932, 13.715370), zoom: 0.0);

  void _onMapCreated(GoogleMapController mapController) async {
    final Database database = await AppDatabase.get().getDb();
    final ClusteringHelper clusteringHelper = ClusteringHelper.forDB(
      database: database,
      mapController: mapController,
      dbGeohashColumn: FakePoint.dbGeohash,
      dbLatColumn: FakePoint.dbLat,
      dbLongColumn: FakePoint.dbLong,
      dbTable: FakePoint.tblFakePoints,

  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text("Clustering Example"),
      body: GoogleMap(
        onMapCreated: _onMapCreated,
        trackCameraPosition: true,
        initialCameraPosition: initialCameraPosition,

See the example directory for a complete sample app.

0.0.1+2 #

  • Add new marker for new level of aggregation.
  • Fix level for aggregation/disgregation
  • Add InfoWindowText on aggregated marker with number of points

0.0.1 #

  • Initial developers preview release.


example #

A new Flutter application.

Getting Started #

This project is a starting point for a Flutter application.

A few resources to get you started if this is your first Flutter project:

For help getting started with Flutter, view our online documentation, which offers tutorials, samples, guidance on mobile development, and a full API reference.

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:

  clustering_google_maps: ^0.0.1+2

2. Install it

You can install packages from the command line:

with Flutter:

$ flutter packages get

Alternatively, your editor might support flutter packages get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:

import 'package:clustering_google_maps/clustering_google_maps.dart';
Version Uploaded Documentation Archive
0.0.1+2 Feb 11, 2019 Go to the documentation of clustering_google_maps 0.0.1+2 Download clustering_google_maps 0.0.1+2 archive
0.0.1+1 Feb 10, 2019 Go to the documentation of clustering_google_maps 0.0.1+1 Download clustering_google_maps 0.0.1+1 archive
0.0.1 Feb 10, 2019 Go to the documentation of clustering_google_maps 0.0.1 Download clustering_google_maps 0.0.1 archive
Describes how popular the package is relative to other packages. [more]
Code health derived from static analysis. [more]
Reflects how tidy and up-to-date the package is. [more]
Weighted score of the above. [more]
Learn more about scoring.

We analyzed this package on Feb 14, 2019, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.1.0
  • pana: 0.12.13
  • Flutter: 1.2.0


Detected platforms: Flutter

References Flutter, and has no conflicting libraries.

Health issues and suggestions

Document public APIs. (-1 points)

21 out of 21 API elements have no dartdoc comment.Providing good documentation for libraries, classes, functions, and other API elements improves code readability and helps developers find and use your API.

Format lib/clustering_google_maps.dart.

Run flutter format to format lib/clustering_google_maps.dart.

Maintenance suggestions

Package is pre-v0.1 release. (-10 points)

While nothing is inherently wrong with versions of 0.0.*, it might mean that the author is still experimenting with the general direction of the API.


Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.1.0 <3.0.0
flutter 0.0.0
geohash ^0.2.1 0.2.1
google_maps_flutter 0.2.0+2 0.2.0+2
path_provider ^0.4.1 0.4.1 0.5.0+1
sqflite ^0.12.2+1 0.12.2+1 1.1.0
Transitive dependencies
collection 1.14.11
meta 1.1.6 1.1.7
path 1.6.2
sky_engine 0.0.99
synchronized 2.0.2+1
typed_data 1.1.6
vector_math 2.0.8
Dev dependencies