map<R extends Object?> method
R
map<R extends Object?>({
- required R initialState(
- InitialState<
T> initialState
- InitialState<
- required R loadingState(
- LoadingState<
T> loadingState
- LoadingState<
- required R succeedState(
- SucceedState<
T> succeedState
- SucceedState<
- required R failedState(
- FailedState<
T> failedState
- FailedState<
Implementation
R map<R extends Object?>({
required R Function(InitialState<T> initialState) initialState,
required R Function(LoadingState<T> loadingState) loadingState,
required R Function(SucceedState<T> succeedState) succeedState,
required R Function(FailedState<T> failedState) failedState,
}) {
final FourStates<T> state = this;
return switch (state) {
InitialState<T>() => initialState(state),
LoadingState<T>() => loadingState(state),
SucceedState<T>() => succeedState(state),
FailedState<T>() => failedState(state),
};
}