Flutter 网络请求charles抓不到包的问题

2020-05-22  本文已影响0人  张_何

问题

解决

import 'package:dio/dio.dart';
import 'package:dio/adapter.dart';
...
(dio.httpClientAdapter as DefaultHttpClientAdapter).onHttpClientCreate = (client) {
    // config the http client
    client.findProxy = (uri) {
        //proxy all request to localhost:8888
        return "PROXY localhost:8888"; //这里将localhost设置为自己电脑的IP,其他不变,注意上线的时候一定记得把代理去掉
    };
    // you can also create a HttpClient to dio
    // return HttpClient();
};
上一篇下一篇

猜你喜欢

热点阅读