when<T extends Object> abstract method

T when<T extends Object>({
  1. required T loading(
    1. LceLoading<DATA> state
    ),
  2. required T content(
    1. LceContent<DATA> state
    ),
  3. required T error(
    1. LceError<DATA> state
    ),
  4. T terminated()?,
})

Emulates sealed class with every state callback required except terminated. Override it if you expect termination or leave empty to throw exception

Implementation

T when<T extends Object>({
  required T Function(LceLoading<DATA> state) loading,
  required T Function(LceContent<DATA> state) content,
  required T Function(LceError<DATA> state) error,
  T Function()? terminated
});