checkAuth method
Checks stored tokens and emits Authenticated or Unauthenticated. Call this on app startup.
Implementation
Future<void> checkAuth() async {
emit(const AuthLoading());
final hasToken = await _tokenStorage.hasToken();
if (hasToken) {
emit(const Authenticated());
} else {
emit(const Unauthenticated(reason: UnauthenticatedReason.noToken));
}
}