https://github.com/netsells/dio-proxy-adapter
Simple proxy configuration for Dio.
https://github.com/netsells/dio-proxy-adapter
Last synced: about 1 month ago
JSON representation
Simple proxy configuration for Dio.
- Host: GitHub
- URL: https://github.com/netsells/dio-proxy-adapter
- Owner: netsells
- License: mit
- Created: 2022-05-17T10:00:50.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2022-05-17T10:07:26.000Z (almost 3 years ago)
- Last Synced: 2025-03-24T04:51:42.490Z (about 2 months ago)
- Language: Dart
- Size: 2.93 KB
- Stars: 2
- Watchers: 1
- Forks: 2
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# dio_proxy_adapter
Simple proxy configuration for [Dio](https://pub.dev/packages/dio).
Can be used with proxy applications like [Charles](http://charlesproxy.com) or [Proxyman](http://proxyman.io).
## Getting started
*Please follow the setup instructions for your proxy server of choice. For Flutter apps, [Charles](http://charlesproxy.com) and [Proxyman](http://proxyman.io) work great with this package.*
Add the following dependencies to your `pubspec.yaml`:
```yaml
dependencies:
dio: ^4.0.6
dio_proxy_adapter: ^1.0.1
```## Usage
Simply add the `useProxy` extension method to your Dio instance:
```dart
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:
```dart
dio.useProxy(bool.hasEnvironment('PROXY_URL') ? String.fromEnvironment('PROXY_URL') : null);