NitroHttpDioAdapter constructor

NitroHttpDioAdapter({
  1. ClientSettings settings = const nh.ClientSettings(),
  2. NitroHttpClient? client,
})

Creates an adapter.

With no client the adapter builds and owns one from settings, and close disposes it. Pass client to share an existing client — the adapter then borrows it and close leaves it running.

A borrowed client should be configured with throwOnStatusCode: false; dio's own validateStatus decides what counts as a failure, and a client that also throws turns a 404 into a DioExceptionType.badResponse with no Response attached. An owned client gets that setting forced.

Implementation

NitroHttpDioAdapter({
  nh.ClientSettings settings = const nh.ClientSettings(),
  nh.NitroHttpClient? client,
}) : _ownsClient = client == null,
     _client = client ?? _buildOwnedClient(settings);