fetchUserData method

Future<void> fetchUserData()

Fetch user data using the authenticated user's ID

Implementation

Future<void> fetchUserData() async {
  try {
    final userId = _authRepo.getUserID;
    if (userId.isNotEmpty) {
      final userData = await _userRepo.getUserDetailsById(userId);
      user.value = userData;
    } else {
      Helper.warningSnackBar(title: 'Error', message: 'No user found!');
      throw Exception('No user found!');
    }
  } catch (e) {
    Helper.errorSnackBar(title: 'Error', message: e.toString());
    rethrow;
  }
}