addAll method

Future<List<MarkerId>> addAll(
  1. Iterable<GeoPoint> positions
)

Adds markers in one native command and returns their stable IDs.

Implementation

Future<List<MarkerId>> addAll(Iterable<GeoPoint> positions) async {
  final values = positions.toList(growable: false);
  if (values.isEmpty) return const [];
  final entries = <MarkerId, GeoPoint>{
    for (final position in values) _controller._nextMarkerId(): position,
  };
  _issuedIds.addAll(entries.keys);
  try {
    final transport = await _controller._readyTransport();
    await transport.addMarkers(entries);
    return entries.keys.toList(growable: false);
  } catch (_) {
    _issuedIds.removeAll(entries.keys);
    rethrow;
  }
}