signOut method

Future<void> signOut()

Cierra la sesión del usuario y limpia el estado local.

Implementation

Future<void> signOut() async {
  try {
    _isLoading = true;
    notifyListeners();

    await _authService.logout();

    _userRole = null;
    _userName = null;
    _serviceId = null;
    _userId = null;
    _errorMessage = null;
  } catch (e) {
    _errorMessage = "Error al cerrar sesión";
  } finally {
    _isLoading = false;
    notifyListeners();
  }
}