mapOr<TR> method Null safety

TR mapOr<TR>(
  1. {ResultMapper<TR>? pending,
  2. ResultMapper<TR>? waiting,
  3. ResultMapper<TR>? completed,
  4. FailedResultMapper<TR>? failed,
  5. ResultMapper<TR>? finished,
  6. required ResultMapper<TR> orElse}

Pattern match the result with else branch

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

finished is either completed or failed. Not called if failed or completed is given.

orElse is called if no specific state mapper is given


TR mapOr<TR>({
  ResultMapper<TR>? pending,
  ResultMapper<TR>? waiting,
  ResultMapper<TR>? completed,
  FailedResultMapper<TR>? failed,
  ResultMapper<TR>? finished,
  required ResultMapper<TR> orElse,
}) =>
      pendingResult: pending,
      waitingResult: waiting,
      completedResult: completed,
      failedResult: failed,
      isFinished: finished,
      orElse: orElse,