How to set proxy for flutter app

1,673 views
Skip to first unread message

Mohammad Meshkani

unread,
Aug 16, 2018, 3:18:09 PM8/16/18
to Flutter Dev
I want to set proxy for my app like as set proxy for app with retrofit in android native. is this possible? actually i  want to use proxy for firebase

Jimmy Aumard

unread,
Aug 24, 2018, 2:07:55 AM8/24/18
to Flutter Dev
I'm interested in this too, for me flutter should take the proxy of the device if it's present, that will allow tools like Charles proxy to work with flutter because for now, we can't see flutter's requests

Brian Egan

unread,
Aug 24, 2018, 6:00:28 AM8/24/18
to Flutter Dev
Hey all,

Yah, I had this struggle as well. You can specify a proxy using the `HttpOverrides` class:

Http.runZoned(() {
  runApp(MyApp());
}, findProxyFromEnvironment: (_, __) {
  return '10.0.2.2';
});

However, that didn't always quite work for me on Android (although it worked for the iOS simulator by specifying a different proxy url). Therefore, I created a flutter_stetho plugin for debugging network requests from the Android side: https://pub.dartlang.org/packages/flutter_stetho

Hope these help!
Brian
Reply all
Reply to author
Forward
0 new messages