addCircles method

Future<List<Circle>> addCircles(
  1. List<CircleOptions> options, [
  2. List<Map>? data
])

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

Change listeners are notified once the circles have been added on the platform side.

The returned Future completes with the added circle once listeners have been notified.
An Exception is thrown if the CircleManager is not initialized (style not loaded yet).

Implementation

Future<List<Circle>> addCircles(
  List<CircleOptions> options, [
  List<Map>? data,
]) async {
  _ensureManagerInitialized(circleManager);

  final circles = [
    for (var i = 0; i < options.length; i++)
      Circle(
        getRandomString(),
        CircleOptions.defaultOptions.copyWith(options[i]),
        data?[i],
      )
  ];
  await circleManager?.addAll(circles);
  if (!isDisposed) notifyListeners();
  return circles;
}