refreshApp function
Future<void>
refreshApp(
{ - bool forceRedraw = false,
})
Implementation
Future<void> refreshApp({bool forceRedraw = false}) async {
if (!state.isContextLoaded || !state.appContext.mounted) {
assert(false,
"App Context was not loaded or not mounted");
return;
}
// Ensure refresh is not called during a widget build
if (SchedulerBinding.instance.schedulerPhase != SchedulerPhase.idle) {
await SchedulerBinding.instance.endOfFrame;
if (!state.appContext.mounted) {
assert(false, "App Context was not mounted");
return;
}
}
if (forceRedraw) {
state.keyValue = state.keyValue == 0? 1 : 0;
}
state.appRefreshFn(() {});
}