createRemovePlannedRouteCommandBatch function

JsonCommandBatch createRemovePlannedRouteCommandBatch(
  1. String routeId, {
  2. Iterable<String> iconUrls = const [],
  3. CommandBuilderOptions options = const CommandBuilderOptions(namespace: 'crm-planned-route'),
})

Implementation

JsonCommandBatch createRemovePlannedRouteCommandBatch(
  String routeId, {
  Iterable<String> iconUrls = const [],
  CommandBuilderOptions options = const CommandBuilderOptions(
    namespace: 'crm-planned-route',
  ),
}) {
  final ids = getPlannedRouteCommandIds(
    routeId,
    namespace: options.namespace,
    origin: options.origin,
  );
  return buildCommandBatch([
    mapCommand('source', 'remove', {'sourceId': ids.sourceId}),
    mapCommand('image', 'remove', {'imageId': ids.arrowImageId}),
    for (final url in iconUrls.toSet())
      mapCommand('image', 'remove', {'imageId': _pointImageId(url, options)}),
  ], options: options);
}