Flutter Dio Charles抓包设置

正常抓是不走代理的,需要给dio对象配置代理:

Dio dio = Dio();
    
(dio.httpClientAdapter as DefaultHttpClientAdapter).onHttpClientCreate = (HttpClient client) {
  client.findProxy = (uri) {
    return "PROXY localhost:8888";
  };
};

localhost mac电脑可以用ifconfig命令看,或者直接在Charles——>Help——>Local IP Address


Flutter Dio Charles抓包设置_第1张图片
image.png

你可能感兴趣的:(Flutter Dio Charles抓包设置)