logout static method
Implementation
static Future<void> logout() async {
if (await isAuthenticated() == false) {
throw Exception("user is currently not logged in");
}
try {
String accessToken = await getAccessToken();
_secureStorage.delete(key: _accessTokenKey);
_secureStorage.delete(key: _refreshTokenKey);
_currentUser = User();
_accessToken = "";
_refreshToken = "";
HeraRequest req = HeraRequest()
..namespace = _namespace
..accessToken = accessToken
..token = (Token()..accessToken = _accessToken);
await _heraClient.logout(req);
if (onLogout != null) {
onLogout!();
}
} catch (e) {
if (_debug == true) print("could not logout user: " + e.toString());
rethrow;
}
}