logout method
Logs out the current user from dropbox.
Implementation
@override
Future<bool> logout() async {
debugPrint('Logging out from Dropbox.');
if (_isAuthenticated && _token != null) {
try {
// Attempt to revoke the token on Dropbox's servers.
await _dio.post('https://api.dropboxapi.com/2/auth/token/revoke');
debugPrint('Successfully revoked Dropbox token via API.');
} catch (e) {
debugPrint(
'Failed to revoke Dropbox token via API, but logging out locally anyway.');
}
}
// Clear local state regardless of API call success.
await _clearToken();
_token = null;
_account = null;
_isAuthenticated = false;
return true;
}