partialWhen method
- @Deprecated('Use `whenOrNull` instead. Will be removed by next release.')
void
partialWhen(
{ - void showLoading()?,
- void showContent(
- List<FormViewModel> viewModels,
- bool showNonEditableFields
)?,
- void orElse(
- EditFormUIState editFormUIState
)?,
})
Implementation
@Deprecated('Use `whenOrNull` instead. Will be removed by next release.')
void partialWhen({
void Function()? showLoading,
void Function(List<FormViewModel> viewModels, bool showNonEditableFields)?
showContent,
void Function(EditFormUIState editFormUIState)? orElse,
}) {
final editFormUIState = this;
if (editFormUIState is EditFormUIStateShowLoading) {
if (showLoading != null) {
showLoading();
} else if (orElse != null) {
orElse(editFormUIState);
}
} else if (editFormUIState is EditFormUIStateShowContent) {
if (showContent != null) {
showContent(
editFormUIState.viewModels, editFormUIState.showNonEditableFields);
} else if (orElse != null) {
orElse(editFormUIState);
}
} else {
throw AssertionError();
}
}