flutwire_dio 1.0.0
flutwire_dio: ^1.0.0 copied to clipboard
A Dio interceptor for Flutwire. It records the calls that the dart:io capture cannot see, such as every call on the web.
flutwire_dio #
A Dio interceptor for Flutwire, the network inspector that opens from the notification shade.
Most apps do not need it. Flutwire.init already records every call made through dart:io, and that includes Dio's default adapter. Add this package for the web, where there is no dart:io, and for Dio adapters with a transport of their own.
Usage #
flutter pub add flutwire_dio
final dio = Dio()..interceptors.add(FlutwireDioInterceptor());
Add it last, so that it sees the headers the other interceptors added.
Where the dart:io capture is installed, which is the default outside the web, the interceptor stands down: the capture already sees the call with the bytes that went over the wire, and recording it twice would only fill the list. Pass force: true to record anyway. When the interceptor stands down and the capture never sees the call, as with an adapter that has a transport of its own, the inspector names Dio above the list.
What it records #
The call as Dio sees it: the request data before the transformer encodes it, and the response data after the transformer decoded it. A FormData body is described by its fields and files rather than reproduced byte for byte. A response read as a stream is not recorded, because reading it would consume it.