deliverFiles static method

Future<ChartExportDeliveryBatchResult> deliverFiles(
  1. Iterable<ChartExportFile> files,
  2. ChartExportDeliveryAdapter adapter, {
  3. Duration? timeout,
  4. ChartExportCancellationToken? cancellationToken,
  5. ChartExportDeliveryBatchOptions batchOptions = const ChartExportDeliveryBatchOptions(),
})

Implementation

static Future<ChartExportDeliveryBatchResult> deliverFiles(
  Iterable<ChartExportFile> files,
  ChartExportDeliveryAdapter adapter, {
  Duration? timeout,
  ChartExportCancellationToken? cancellationToken,
  ChartExportDeliveryBatchOptions batchOptions =
      const ChartExportDeliveryBatchOptions(),
}) async {
  final fileList = List<ChartExportFile>.unmodifiable(files);
  final results = <ChartExportDeliveryResult>[];
  for (final file in fileList) {
    final delivery = await deliverFile(
      file,
      adapter,
      timeout: timeout ?? batchOptions.timeout,
      cancellationToken: cancellationToken ?? batchOptions.cancellationToken,
    );
    results.add(delivery);
    _emitBatchProgress(
      batchOptions,
      ChartExportDeliveryBatchProgress(
        completed: results.length,
        total: fileList.length,
        result: delivery,
      ),
    );
    if (batchOptions.stopOnFirstFailure && !delivery.success) break;
  }
  return ChartExportDeliveryBatchResult(results);
}