restoreJobs method

void restoreJobs({
  1. bool storeResults = true,
  2. void onResult(
    1. List<Map<String, String>>,
    2. String
    )?,
  3. void onError(
    1. Exception,
    2. String
    )?,
})

Restores all jobs from storage

Implementation

void restoreJobs({
  bool storeResults = true,
  void Function(List<Map<String, String>>, String)? onResult,
  void Function(Exception, String)? onError,
}) {
  _jobScheduler.restoreJobs(
    onResult: (results, id) {
      if (storeResults) {
        final jobs = _jobScheduler.getJobs();
        final job = jobs.firstWhere((job) => job.id == id);
        _storageManager.storeStructuredData(id, job.url, results);
      }
      onResult?.call(results, id);
    },
    onError: onError,
  );
}