dio_proxy_adapter
Simple proxy configuration for Dio.
Can be used with proxy applications like Charles or Proxyman.
Getting started
Please follow the setup instructions for your proxy server of choice. For Flutter apps, Charles and Proxyman work great with this package.
Add the following dependencies to your pubspec.yaml
:
dependencies:
dio: ^4.0.6
dio_proxy_adapter: ^1.0.1
Usage
Simply add the useProxy
extension method to your Dio instance:
final dio = Dio();
// Configure Dio here
dio.useProxy('localhost:8888');
We recommend passing your proxy URL to your application as an environment variable using --dart-define
. Then you can configure your proxy like this:
dio.useProxy(bool.hasEnvironment('PROXY_URL') ? String.fromEnvironment('PROXY_URL') : null);
Libraries
- dio_proxy_adapter
- Simple proxy configuration for Dio.