Skip to content

A powerful HTTP client for Dart and Flutter, which supports global settings, Interceptors, FormData, aborting and canceling a request, files uploading and downloading, requests timeout, custom adapters, etc.

License

cfug/dio

main
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Latest commit

Improve default parameter naming for
[Interceptor](https://github.com/cfug/dio/blob/a7a787840b87def9d16c10c009c548ddfcd86337/dio/lib/src/interceptor.dart#L192-L206).

```dart
class Interceptor {
  /// The constructor only helps sub-classes to inherit from.
  /// Do not use it directly.
  const Interceptor();

  /// Called when the request is about to be sent.
  void onRequest(
    RequestOptions options,
    RequestInterceptorHandler handler,
  ) {
    handler.next(options);
  }

  /// Called when the response is about to be resolved.
  void onResponse(
    Response response,
    ResponseInterceptorHandler handler,
  ) {
    handler.next(response);
  }

  /// Called when an exception was occurred during the request.
  void onError(
    DioException err,
    ErrorInterceptorHandler handler,
  ) {
    handler.next(err);
  }
}
```

### New Pull Request Checklist

- [x] I have read the
[Documentation](https://pub.dev/documentation/dio/latest/)
- [x] I have searched for a similar pull request in the
[project](https://github.com/cfug/dio/pulls) and found none
- [x] I have updated this branch with the latest `main` branch to avoid
conflicts (via merge from master or rebase)
- [ ] I have added the required tests to prove the fix/feature I'm
adding
- [ ] I have updated the documentation (if necessary)
- [x] I have run the tests without failures
- [ ] I have updated the `CHANGELOG.md` in the corresponding package

### Additional context and info (if any)

<!-- Provide more context and info about the PR. -->
f4606cf

Git stats

Files

Permalink
Failed to load latest commit information.

dio

Language: English | 简体中文

This is the base repo of the dio project. Please move specific paths for project instructions.

dio

Before you upgrade: Breaking changes might happen in major and minor versions of packages.
See the Migration Guide for the complete breaking changes list.

Plugins

  • cookie_manager: link Pub
  • http2_adapter: link Pub
  • native_dio_adapter: link Pub

Examples

  • example: link
  • example_flutter_app: link

Copyright & License

The project and its underlying projects are originally authored by @wendux with the organization @flutterchina, started being maintained by Chinese Flutter User Group (@cfug) since 2023.

The project consents the MIT license.

Star History

Star History Chart