deliverBatch static method

Future<ChartExportDeliveryBatchResult> deliverBatch(
  1. ChartExportBatchResult batch,
  2. ChartExportDeliveryAdapter adapter, {
  3. Duration? timeout,
  4. ChartExportCancellationToken? cancellationToken,
  5. ChartExportDeliveryBatchOptions batchOptions = const ChartExportDeliveryBatchOptions(),
})

Implementation

static Future<ChartExportDeliveryBatchResult> deliverBatch(
  ChartExportBatchResult batch,
  ChartExportDeliveryAdapter adapter, {
  Duration? timeout,
  ChartExportCancellationToken? cancellationToken,
  ChartExportDeliveryBatchOptions batchOptions =
      const ChartExportDeliveryBatchOptions(),
}) async {
  final results = <ChartExportDeliveryResult>[];
  for (final result in batch.results) {
    final delivery = await deliverResult(
      result,
      adapter,
      timeout: timeout ?? batchOptions.timeout,
      cancellationToken: cancellationToken ?? batchOptions.cancellationToken,
    );
    results.add(delivery);
    _emitBatchProgress(
      batchOptions,
      ChartExportDeliveryBatchProgress(
        completed: results.length,
        total: batch.results.length,
        result: delivery,
      ),
    );
    if (batchOptions.stopOnFirstFailure && !delivery.success) break;
  }
  return ChartExportDeliveryBatchResult(results);
}