证书
wifi
手机和电脑连上同一个wifi,并且手机wifi使用代理,代理地址为电脑的ip和proxyman设置的监听端口
代码
import 'package:dio/dio.dart';
import 'package:dio/io.dart';
import 'dart:io';
class ProxyUtil {
static String proxyIP = "";
static String proxyPort = "9090";
static Dio useProxy(Dio dio) {
if (proxyIP == "") return dio;
dio.httpClientAdapter = IOHttpClientAdapter(
createHttpClient: () {
final client = HttpClient();
client.findProxy = (uri) {
// Proxy all request to localhost:8888.
// Be aware, the proxy should went through you running device,
// not the host platform.
return 'PROXY $proxyIP:$proxyPort';
};
client.badCertificateCallback = (X509Certificate cert, String host, int port) => true;
return client;
},
);
return dio;
}
}
使用方式文章来源:https://www.toymoban.com/news/detail-769110.html
Dio dio = Dio();
ProxyUtil.useProxy(dio);
proxyIP
为电脑ip文章来源地址https://www.toymoban.com/news/detail-769110.html
到了这里,关于flutter dio使用proxyman抓包进行网络调试的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!