restoreJobs method

void restoreJobs({
  1. void onResult(
    1. List<Map<String, String>>,
    2. String
    )?,
  2. void onError(
    1. Exception,
    2. String
    )?,
})

Restores all jobs from storage

Implementation

void restoreJobs({
  void Function(List<Map<String, String>>, String)? onResult,
  void Function(Exception, String)? onError,
}) {
  final jobs = getJobs();

  for (final job in jobs) {
    _scheduleJob(
      job,
      onResult != null ? (result) => onResult(result, job.id) : null,
      onError != null ? (error) => onError(error, job.id) : null,
    );
  }
}