failNext method

void failNext(
  1. int count, {
  2. String error = 'Simulated failure',
  3. bool permanent = false,
})

Fails the next count batches entirely with error.

Implementation

void failNext(int count,
    {String error = 'Simulated failure', bool permanent = false}) {
  for (var i = 0; i < count; i++) {
    _script.add((batch) => SyncResult.allFailed(
          {for (final t in batch) t.taskId: error},
          permanent: permanent,
        ));
  }
}