map<TR> method Null safety

TR map<TR>(
  1. {required ResultMapper<TR> pending,
  2. required ResultMapper<TR> waiting,
  3. required ResultMapper<TR> completed,
  4. required FailedResultMapper<TR> failed}

Pattern match the result on all branches

pending is called with action hasn't started waiting is called when action is in progress completed is called if result is completed failed is called with error and stackTrace if result is failed


TR map<TR>({
  required ResultMapper<TR> pending,
  required ResultMapper<TR> waiting,
  required ResultMapper<TR> completed,
  required FailedResultMapper<TR> failed,
}) =>
      pendingResult: pending,
      waitingResult: waiting,
      completedResult: completed,
      failedResult: failed,