addPolygons method

Future<List<Polygon>> addPolygons(
  1. List<PolygonOptions> options, [
  2. List<Map>? data
])

Adds multiple fills to the map, configured using the specified custom options.

Change listeners are notified once the fills has been added on the platform side.

The returned Future completes with the added fills once listeners have been notified.

Implementation

Future<List<Polygon>> addPolygons(List<PolygonOptions> options,
    [List<Map>? data]) async {
  final fills = [
    for (var i = 0; i < options.length; i++)
      Polygon(getRandomString(),
          PolygonOptions.defaultOptions.copyWith(options[i]), data?[i])
  ];
  await polygonManager!.addAll(fills);

  notifyListeners();
  return fills;
}