addLine method

Future<Line> addLine(
  1. LineOptions 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> addLine(LineOptions options, [Map? data]) async {
  final effectiveOptions = LineOptions.defaultOptions.copyWith(options);
  final line = Line(getRandomString(), effectiveOptions, data);
  await lineManager!.add(line);
  notifyListeners();
  return line;
}