Force http from dart.dev to use dio from flutterchina.club

Viewed 210

I have built interceptors around dio for error handling,logging and cache. I found some other packages like cached_network_image, advance_pdf_viewer use dart.dev's http client.

I want to make same requests processed from cached_network_image, advance_pdf_viewer from dio's client so that custom error messages are displayed in UI which provides uniformity.

Future<Dio> _getDio() async {
    final dio = Dio()..options.baseUrl = ApiEndPoints.base;
    dio.interceptors.addAll([
      DioCachingInterceptor(
        connectivity,
      ),
      DioAppInterceptor(),
      DioLoggingInterceptor(),
    ]);
    return dio;
  }

Any Ideas??

0 Answers
Related