safeSetState method

FutureOr<void> safeSetState(
  1. FutureOr fn()
)

Implementation

FutureOr<void> safeSetState(FutureOr<dynamic> Function() fn) async {
  await fn();
  if (mounted) {
    // ignore: invalid_use_of_protected_member
    setState(() {});
  }
}