addLines method
Adds multiple lines to the map, configured using the specified custom options.
Change listeners are notified once the lines have been added on the platform side.
The returned Future completes with the added line once listeners have
been notified.
An Exception is thrown if the LineManager is not initialized (style not loaded yet).
Implementation
Future<List<Line>> addLines(
List<LineOptions> options, [
List<Map>? data,
]) async {
_ensureManagerInitialized(lineManager);
final lines = [
for (var i = 0; i < options.length; i++)
Line(
getRandomString(),
LineOptions.defaultOptions.copyWith(options[i]),
data?[i],
)
];
await lineManager?.addAll(lines);
if (!isDisposed) notifyListeners();
return lines;
}