Retrofit
Alice supports Retrofit out of the box because it is built on top of Dio.
To integrate Alice with Retrofit, you simply need to add the alice_dio interceptor to the Dio instance that is passed to your Retrofit RestClient constructor.
Setup
- Add
aliceandalice_dioto yourpubspec.yamldependencies. - Initialize
Alice:
Alice alice = Alice(navigatorKey: navigatorKey);
- Configure your
Dioinstance:
final dio = Dio();
dio.interceptors.add(alice.getDioInterceptor());
- Pass the
dioinstance to yourRestClient:
final client = RestClient(dio);
Now, all network requests performed by your RestClient will be captured and displayed in the Alice inspector.