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