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 LineOptions effectiveOptions =
      LineOptions.defaultOptions.copyWith(options);
  final line = await _mapboxGlPlatform.addLine(effectiveOptions, data);
  _lines[line.id] = line;
  notifyListeners();
  return line;
}