http_proxy_mobile
Flutter package for reversing all requests through the proxy connection to which you are connected in Android and iOS
Getting Started
1 Step
Include our package in your pubspec.yaml
http_proxy_mobile: ^0.0.6
2 Step
Realize singletone service to use our methods
import 'package:http_proxy_mobile/http_proxy_mobile.dart';
import 'package:http_proxy_mobile/proxy_data.dart';
class ProxyService {
ProxyService();
// Returned actually proxy connection in ProxyData
Future<ProxyData> get getProxySettings async {
ProxyData proxy = await HttpProxyMobile.getProxySettings();
return proxy;
}
// Created proxy connection
Future<void> createProxyConnection({ProxyData? data}) async {
HttpProxyMobile httpProxy =
await HttpProxyMobile.createHttpProxy(data: data);
if (httpProxy.proxyData.host != null && httpProxy.proxyData.port != null) {
print('Proxy Address: ${httpProxy.proxyData.host}');
print('Proxy Port: ${httpProxy.proxyData.port}');
} else {
print('Proxy settings not found.');
}
}
}
3 Step
Use method createProxyConnection
from ProxyService
in code when you need
void main() async {
final ProxyService proxyService = ProxyService();
await proxyService.createProxyConnection();
}