safeSetState method
安全刷新
Implementation
FutureOr<void> safeSetState(FutureOr<dynamic> Function() fn) async {
if (mounted &&
!context.debugDoingBuild &&
context.owner?.debugBuilding == false) {
await fn();
setState(() {});
}
}