Skip to main content

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​

  1. Add alice and alice_dio to your pubspec.yaml dependencies.
  2. Initialize Alice:
Alice alice = Alice(navigatorKey: navigatorKey);
  1. Configure your Dio instance:
final dio = Dio();
dio.interceptors.add(alice.getDioInterceptor());
  1. Pass the dio instance to your RestClient:
final client = RestClient(dio);

Now, all network requests performed by your RestClient will be captured and displayed in the Alice inspector.

Example​

View the full Alice Retrofit Example on GitHub