httpOverrides property

set httpOverrides (bool setOverrides)
inherited

Dio HTTP Overrides enable overrides to handle badCertificateCallback. available only for the non-Web platform.

Implementation

set httpOverrides(bool setOverrides) {
  if (!kIsWeb && setOverrides) {
    dio.Dio dioOverrides = dio.Dio();
    final adapter = dioOverrides.httpClientAdapter;
    if (adapter is IOHttpClientAdapter) {
      adapter.createHttpClient = () {
        final client = IO.HttpClient();
        client.badCertificateCallback = (cert, host, port) {
          return true;
        };
        return client;
      };
    }
    _dio = dioOverrides;
  }
}