Commit f5c81368 authored by Leon Tappe's avatar Leon Tappe 🔥
Browse files

check for verificationStore before loading

parent 5c6ef93b
......@@ -49,7 +49,7 @@ class VerificationBloc extends Bloc<VerificationEvent, VerificationState> {
_verification = response!;
await _verificationStore!.writeAsString(json.encode(_verification!.toMap));
yield VerificationState.verified;
} else {
} else if (_verificationStore?.existsSync() ?? false) {
final loaded =
VerificationResponse.fromMap(json.decode(await _verificationStore!.readAsString()));
if (loaded.timestamp.isAfter(DateTime.now().subtract(const Duration(minutes: 30)))) {
......@@ -58,6 +58,8 @@ class VerificationBloc extends Bloc<VerificationEvent, VerificationState> {
} else {
yield VerificationState.unverified;
}
} else {
yield VerificationState.unverified;
}
}
break;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment