Skip to main content
layers

Polygon Layer

PolygonLayer fills and outlines areas. Polygon keeps flutter_map's fields — points, holePointsList, color, borderColor, borderStrokeWidth — drawn natively on Google Maps and MapKit, by flutter_map elsewhere.

PolygonLayer(
  polygons: [
    Polygon(points: countryBorder, color: Color(0x66009688), borderStrokeWidth: 2),
  ],
)

The demo outlines every European country, shows the tapped one's name, and highlights it on tap:

Apple MapKit (iOS)Google Maps (Android)
The countries of Europe outlined, Poland highlightedThe countries of Europe outlined on Google Maps

Holes and taps​

  • Holes (holePointsList) are supported.
  • A tap is resolved in Dart through the layer's hit tester — pass a hitNotifier to PolygonLayer and read the tapped polygon in MapOptions.onTap.
On this page