arch-atlas

Logout Use Case

domain/usecases

domain

Overview

Tears down the current session: clears the cached token, drops in-memory user state, and (best-effort) tells the backend to invalidate the refresh token.

User Flow

  1. Controller calls LogoutUseCase().
  2. Repository.logout() fires POST /auth/logout (fire-and-forget).
  3. Local data source clears the token from secure storage.
  4. Returns Either<AuthFailure, Unit>.

Cases & Edge Cases

  • Backend unreachable → still clear local token; never block the user from logging out.
  • Local storage write fails → surface a warning but continue navigation to /login.

Code References

  • lib/features/auth/domain/usecases/logout_usecase.dart

API Calls

Empty — fill this in later. Open the manifest and add content here.

Notes

Logout must always succeed locally — the user expects to land on /login. Treat the network call as best-effort cleanup.