cacheExists function
Implementation
Future<bool> cacheExists(BuildContext ctx, Widget child) async {
try {
if (UserInfoState().isGuest) {
final r = await reloadUserInfo(ctx, child);
if (r != null) {
return retrieveUser(
await UserInfoState().userStorageService.getPreference(
preValue: await Geolocator.getCurrentPosition(
locationSettings:
AppleSettings(accuracy: LocationAccuracy.high),
),
preKey: r));
} else {
showNotify(
'Location services are turned off. Please enable them in your device settings to continue.');
return false;
}
} else {
return retrieveUser(
await UserInfoState().userStorageService.getPreference());
}
} catch (_) {
return false;
}
}