NitroHttpDioAdapter class

Routes every dio request through a nh.NitroHttpClient.

final dio = Dio()..httpClientAdapter = NitroHttpDioAdapter();

The adapter is deliberately thin: it translates RequestOptions into an nh.HttpRequest, always takes the engine's streamed path, and hands the body stream straight back to dio. Collecting that stream into bytes, JSON or a file, validating the status code, and reporting progress all happen in dio's own layers above this class, so nothing here duplicates them.

Two layers of interceptors exist once this adapter is installed: dio's run above it, nitro_http's run below. Neither can see the other's rewrites.

Constructors

NitroHttpDioAdapter({ClientSettings settings = const nh.ClientSettings(), NitroHttpClient? client})
Creates an adapter.

Properties

client NitroHttpClient
The client this adapter sends through.
no setter
hashCode int
The hash code for this object.
no setterinherited
ownsClient bool
Whether this adapter created client and will dispose it on close.
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

close({bool force = false}) → void
Close the current adapter and its inner clients or requests.
fetch(RequestOptions options, Stream<Uint8List>? requestStream, Future<void>? cancelFuture) Future<ResponseBody>
Implement this method to make real HTTP requests.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

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

Static Properties

clientFactoryForTesting NitroHttpClient Function(ClientSettings settings)?
Test seam: overrides how an adapter builds the client it owns.
getter/setter pair