Flutter|Flutter Dio Charles抓包设置

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

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

【Flutter|Flutter Dio Charles抓包设置】localhost mac电脑可以用ifconfig命令看,或者直接在Charles——>Help——>Local IP Address

Flutter|Flutter Dio Charles抓包设置
文章图片
image.png

    推荐阅读