i need to set proxy globally in my project, i did that with flutter_socks_proxy
package.
void main() {
WidgetsFlutterBinding.ensureInitialized();
SocksProxy.initProxy(
proxy: 'SOCKS5 192.111.139.165:4145',
onCreate: (client) {
client.badCertificateCallback =
(X509Certificate cert, String host, int port) => true;
});
runApp(MyApp());
}
it works but i have a problem, i can't access http (non ssl) api after set the proxy.
final url = Uri.parse('http://worldtimeapi.org/api/timezone/Europe/London');
final response = await http.get(url);
print(response.body);
this is the error
[ERROR:flutter/lib/ui/ui_dart_state.cc(198)] Unhandled Exception: Connection reset by peer
it works fine with https apis.