setStateAsync method
Implementation
void setStateAsync(
FutureOr<dynamic> Function() fn, {
void Function(Object e, StackTrace stackTrace)? onError,
}) async {
try {
await fn();
if (mounted) {
// ignore: invalid_use_of_protected_member
setState(() {});
}
} catch (e, stack) {
if (onError != null) {
onError(e, stack);
}
}
}