onRequest method
Called when the request is about to be sent.
Implementation
@override
void onRequest(RequestOptions options, RequestInterceptorHandler handler) {
if (!iadEnabled) {
handler.next(options);
return;
}
options.extra['iad_id'] = _id++;
handler.next(options);
if (_requests.length >= maxRequests) {
_requests.remove(_requests.lastKey());
}
_requests[options.extra['iad_id'] as int] = (
_Request(
uri: options.uri,
method: options.method,
headers: options.headers,
data: options.data,
timestamp: DateTime.timestamp(),
),
null
);
notifyListeners();
}