map<R extends Object?> method
R
map<R extends Object?>({})
Implementation
R map<R extends Object?>({
required R Function() initialState,
required R Function(double? progress) loadingState,
required R Function(T successObject) succeedState,
required R Function(String? failureMessage, dynamic exception) failedState,
}) {
final FourStates<T> state = this;
return switch (state) {
InitialState<T>() => initialState(),
LoadingState<T>() => loadingState(state.progress),
SucceedState<T>() => succeedState(state.successObject),
FailedState<T>() => failedState(state.failureMessage, state.exceptionObject),
};
}