when<R> method
R
when<R>({
- required R loading(),
- required R success(
- T data
- required R error(
- Object? error
- required R empty(),
- R custom()?,
Implementation
R when<R>({
required R Function() loading,
required R Function(T data) success,
required R Function(Object? error) error,
required R Function() empty,
R Function()? custom,
}) => switch (this) {
LoadingStatus() => loading(),
SuccessStatus(:final data) => success(data),
ErrorStatus(error: final err) => error(err),
EmptyStatus() => empty(),
CustomStatus() => (custom ?? loading)(),
};