setStateWithIgnoreError method
void
setStateWithIgnoreError({
- required void fn(),
- void onError(
- Object e,
- StackTrace stackTrace
Implementation
void setStateWithIgnoreError({
required void Function() fn,
void Function(Object e, StackTrace stackTrace)? onError,
}) {
try {
if (mounted) {
// ignore: invalid_use_of_protected_member
setState(fn);
}
} catch (e, stack) {
if (onError != null) {
onError(e, stack);
}
}
}