cancelAllRequests method
Cancel all active requests that were created with createCancelToken.
Optionally provide a reason that will be included in the cancellation error.
Example:
// Cancel all pending requests on logout
api.cancelAllRequests('User logged out');
Implementation
void cancelAllRequests([String? reason]) {
for (final token in _activeCancelTokens) {
if (!token.isCancelled) {
token.cancel(reason);
}
}
_activeCancelTokens.clear();
}