whenElse<T extends Object> method

  1. @override
T whenElse<T extends Object>({
  1. T loading(
    1. LceLoading<DATA> state
    )?,
  2. T content(
    1. LceContent<DATA> state
    )?,
  3. T error(
    1. LceError<DATA> state
    )?,
  4. T terminated()?,
  5. required T onElse(
    1. LceState<DATA> state
    ),
})
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);
}