logout method

Future<void> logout()

Logs out the current user

Implementation

Future<void> logout() async {
  if (tokenStorage.accessToken != null) {
    try {
      await _client.post(
        Uri.parse('$baseUrl/auth/logout'),
        headers: _headers,
      );
    } catch (_) {
      // Ignore logout errors
    }
  }

  await tokenStorage.clearTokens();
}