safeSetState method

void safeSetState(
  1. VoidCallback fn
)

Implementation

void safeSetState(VoidCallback fn) {
  try {
    if (mounted) {
      setState(fn);
    }
    // ignore: empty_catches
  } catch (e) {}
}