setStateWithIgnoreError method

void setStateWithIgnoreError({
  1. required void fn(),
  2. void onError(
    1. Object e,
    2. 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);
    }
  }
}