GoogleMapPolygon constructor
GoogleMapPolygon({
- Key? key,
- required String mapId,
- required String mapKey,
- required GoogleMapPolygonController mapController,
- required CameraPosition initialCameraPosition,
- double mapHeight = 300,
- double mapWidth = double.infinity,
- List<
PolygonData> ? polygons, - PolygonData? singlePolygon,
- bool returnAsWKT = false,
- void onPolygonCreated(
- dynamic value
- bool editPolygon = false,
- void onPolygonEdited(
- dynamic value
Implementation
GoogleMapPolygon({
super.key,
required this.mapId,
required this.mapKey,
required this.mapController,
required this.initialCameraPosition,
this.mapHeight = 300,
this.mapWidth = double.infinity,
this.polygons,
this.singlePolygon,
this.returnAsWKT = false,
this.onPolygonCreated,
this.editPolygon = false,
this.onPolygonEdited,
}) : assert((polygons == null && singlePolygon == null) || (polygons != null && singlePolygon == null) || (polygons == null && singlePolygon != null), 'Can\'t provide both list and a single polygon. Either one or both should be null'),
assert(polygons == null || polygons.map((p) => p.id).toSet().length == polygons.length, 'Duplicate polygon IDs found in the polygons list', ),
assert(mapId.isNotEmpty, 'Map ID can\'t be empty. Head to Google cloud console and get one from Map Styles'),
assert((editPolygon == true && singlePolygon != null && polygons == null) || (editPolygon == false && singlePolygon == null && polygons != null), 'Editing a polygon requires a single polygon data. And the polygon list to be null');