setStateSafe method Null safety

void setStateSafe(
  1. dynamic fn
)

Will call setState only if the current lifecycle state allows it

Implementation

void setStateSafe(VoidCallback fn) {
  if (_debugLifecycleState != StateLifecycle.defunct) {
    setState(fn);
  }
}