mapValue<R> method

ComputedStateValue<R> mapValue<R>(
  1. R block(
    1. T
    )
)

Note: block should be a pure function, since it may be called multiple times.

Implementation

ComputedStateValue<R> mapValue<R>(R Function(T) block) {
  return when(
    notInitialized: () => ComputedStateValue.notInitialized,
    inProgress: (operation) => ComputedStateValue.inProgress(operation.then(block)),
    ready: (value) => ComputedStateValue.ready(block(value)),
    failed: ComputedStateValue.failed,
  );
}