getActualUser static method
Implementation
static Future<User> getActualUser({bool? jwt}) async {
final storage = Sentc.getStorage();
final actualUser = await storage.getItem("actual_user");
if (actualUser == null) {
throw Exception("No actual user found");
}
final userJson = await storage.getItem("user_data_$actualUser");
if (userJson == null) {
throw Exception("The actual user data was not found");
}
final user = User.fromJson(jsonDecode(userJson), baseUrl, appToken);
if (jwt ?? false) {
await user.getJwt();
}
return user;
}