fetchUser method
Implementation
Future<User?> fetchUser() async {
if (!_authenticationService.isAuthenticated) {
return null;
}
try {
User user =
await _apiService.getModelRequest('v1/users/me', User.fromJson);
// Update the user in the service
_currentUser = user;
return user;
} catch (err) {
return null;
}
}