adapter library

Service Provider Interface (SPI) for Interceptly network capture adapters.

Import this library when creating satellite adapters (Dio, Chopper, Http, WebSocket) or implementing custom network traffic collectors.

Classes

CappedBytesBuilder
An in-memory buffer that retains up to maxBytes bytes from streaming data.
DefaultHttpTrafficCollector
Default implementation of HttpTrafficCollector backed by InspectorSession.
DefaultRealtimeTrafficCollector
Default implementation of RealtimeTrafficCollector backed by InspectorSession.
HttpCaptureScope
Scope managing the capture lifecycle of an individual HTTP request-response exchange.
HttpRequestContext
Immutable context tracking an ongoing HTTP request capture lifecycle.
HttpTrafficCollector
Contract for coordinating HTTP traffic capture lifecycle events.
MultipartFileInfo
Metadata for an individual multipart file payload.
NetworkSimulationProfile
Defines runtime network conditions applied by Interceptly wrappers.
RealtimeConnectionSender
Contract implemented by realtime adapters to handle message transmission.
RealtimeFrame
Represents an individual message/frame exchanged over a realtime connection (e.g. WebSocket, SSE, Socket.IO).
RealtimeMessageDraft
Represents a message or event ready to be sent across a realtime connection.
RealtimeSessionScope
Scope managing the lifecycle of an ongoing realtime connection (WebSocket, SSE).
RealtimeTrafficCollector
Contract for coordinating realtime network traffic (WebSocket, SSE, Socket.IO).
RequestId
Generates unique IDs for captured requests.

Enums

FrameDirection
The direction of a realtime frame relative to the client.
FrameType
The protocol payload type or frame control code.
RealtimeProtocolType
Supported realtime connection protocols for Interceptly.

Functions

encodeBodyBytes(Object? body) → Uint8List?
Encodes an arbitrary request or response body into raw Uint8List bytes.
guardCapture<T>(T body()) → T?
Runs body and swallows any error it throws.
guardCaptureAsync<T>(Future<T> body()) → Future<T?>
headerValue(Map<String, String> headers, String name) → String?
Case-insensitive header lookup.
mapHeaderEntries(Map<String, String> headers, {String keyName = 'name', String valueName = 'value'}) → List<Map<String, String>>
Maps a headers map into a list of key-value maps with specified field names.
normalizeHeaders(Map<String, Object?> headers) → Map<String, String>
Normalizes a dynamic or multi-value header map into a string-only map.
summarizeMultipart({Iterable<MapEntry<String, String>> fields = const [], Iterable<MultipartFileInfo> files = const []}) → Uint8List
Generates a standardized, human-readable summary of multipart fields and files without consuming or buffering file streams.
teeStreamCapture(Stream<List<int>> source, {required int maxBytes, Duration chunkDelay(int chunkBytes)?, required void onDone(Uint8List? captured, int totalBytes), required void onError(Object error, StackTrace stackTrace, Uint8List? captured, int totalBytes), required void onCancel(Uint8List? captured, int totalBytes)}) → Stream<List<int>>
Tees source into a new stream that:
truncateUtf8(String text, int maxBytes) → String
Safely truncates text to at most maxBytes bytes in UTF-8 encoding without splitting multi-byte characters or Unicode code points.

Exceptions / Errors

SimulatedNetworkException
Exception thrown when a request is blocked by simulated offline mode.