whenElse<T extends Object> method
T
whenElse<T extends Object>({
- T loading(
- LceLoading<
DATA> state
- LceLoading<
- T content(
- LceContent<
DATA> state
- LceContent<
- T error(
- LceError<
DATA> state
- LceError<
- T terminated()?,
- required T onElse(
- LceState<
DATA> state
- LceState<
override
Emulates sealed class with only one onElse
callback required.
Every unset callback will be routed to onElse
case.
Implementation
@override
T whenElse<T extends Object>({
T Function(LceLoading<DATA> state)? loading,
T Function(LceContent<DATA> state)? content,
T Function(LceError<DATA> state)? error,
T Function()? terminated,
required T Function(LceState<DATA> state) onElse
}) {
return error?.call(this) ?? onElse(this);
}