ThrottleInterceptor class

A package:dio Interceptor that applies a ThrottleController's profile to every request — latency, bandwidth, packet loss, failure injection, response tampering, and per-endpoint rules — and records each request in the live log.

Attach it to your Dio instance:

import 'package:flutter_network_throttler/dio.dart';

final controller = ThrottleController();
final dio = Dio()..interceptors.add(ThrottleInterceptor(controller));

Response tampering operates on String and List<int> response bodies; for it to apply, use ResponseType.plain or ResponseType.bytes (already-parsed JSON objects can't be meaningfully corrupted and are left untouched).

Constructors

ThrottleInterceptor(ThrottleController controller)
Creates an interceptor driven by controller.

Properties

controller → ThrottleController
The controller whose profile drives throttling decisions.
final
hashCode → int
The hash code for this object.
no setterinherited
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
onError(DioException err, ErrorInterceptorHandler handler) → void
Called when an exception was occurred during the request.
inherited
onRequest(RequestOptions options, RequestInterceptorHandler handler) → Future<void>
Called when the request is about to be sent.
onResponse(Response response, ResponseInterceptorHandler handler) → Future<void>
Called when the response is about to be resolved.
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited