maybeWhen<R extends Object?> method
R
maybeWhen<R extends Object?>({
- R showLoading()?,
- R showContent(
- List<
FormViewModel> viewModels, - bool showNonEditableFields
- List<
- required R orElse(
- EditFormUIState editFormUIState
Implementation
R maybeWhen<R extends Object?>({
R Function()? showLoading,
R Function(List<FormViewModel> viewModels, bool showNonEditableFields)?
showContent,
required R Function(EditFormUIState editFormUIState) orElse,
}) {
final editFormUIState = this;
if (editFormUIState is EditFormUIStateShowLoading) {
return showLoading != null ? showLoading() : orElse(editFormUIState);
} else if (editFormUIState is EditFormUIStateShowContent) {
return showContent != null
? showContent(
editFormUIState.viewModels, editFormUIState.showNonEditableFields)
: orElse(editFormUIState);
} else {
throw AssertionError();
}
}