addPolyline method

Future<Line> addPolyline(
  1. PolylineOptions options, [
  2. Map? data
])

Adds a line to the map, configured using the specified custom options.

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

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

Implementation

Future<Line> addPolyline(PolylineOptions options, [Map? data]) async {
  final effectiveOptions = PolylineOptions.defaultOptions.copyWith(options);
  final line = Line(getRandomString(), effectiveOptions, data);
  await polylineManager!.add(line);
  notifyListeners();
  return line;
}