Skip to content

Commit

Permalink
fix: update onReceiveProgress references in docs (#1732)
Browse files Browse the repository at this point in the history
<!-- Write down your pull request descriptions. -->

### 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
- [x] I have updated the documentation (if necessary)
- [ ] 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. -->

Small update on the docs making reference to `onProgress` instead of
`onReceiveProgress`

---------

Signed-off-by: Carlos Gutiérrez Moreno <carlosgutimo.3d@gmail.com>
  • Loading branch information
cgutierr-zgz committed Mar 12, 2023
1 parent e25aae6 commit 70cdbf9
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 10 deletions.
8 changes: 4 additions & 4 deletions dio/lib/src/dio.dart
Original file line number Diff line number Diff line change
Expand Up @@ -208,13 +208,13 @@ abstract class Dio {
///
/// [lengthHeader] : The real size of original file (not compressed).
/// When file is compressed:
/// 1. If this value is 'content-length', the `total` argument of `onProgress` will be -1
/// 1. If this value is 'content-length', the `total` argument of [onReceiveProgress] will be -1
/// 2. If this value is not 'content-length', maybe a custom header indicates the original
/// file size , the `total` argument of `onProgress` will be this header value.
/// file size , the `total` argument of [onReceiveProgress] will be this header value.
///
/// You can also disable the compression by specifying
/// the 'accept-encoding' header value as '*' to assure the value of
/// `total` argument of `onProgress` is not -1. for example:
/// `total` argument of [onReceiveProgress] is not -1. for example:
///
/// ```dart
/// await dio.download(
Expand All @@ -223,7 +223,7 @@ abstract class Dio {
/// options: Options(
/// headers: {HttpHeaders.acceptEncodingHeader: "*"}, // Disable gzip
/// ),
/// onProgress: (received, total) {
/// onReceiveProgress: (received, total) {
/// if (total != -1) {
/// print((received / total * 100).toStringAsFixed(0) + "%");
/// }
Expand Down
6 changes: 3 additions & 3 deletions dio/lib/src/options.dart
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ enum ResponseType {
json,

/// Get the response stream without any transformation. The
/// Response data will be a `ResponseBody` instance.
/// Response data will be a [ResponseBody] instance.
///
/// Response<ResponseBody> rs = await Dio().get<ResponseBody>(
/// url,
Expand Down Expand Up @@ -402,8 +402,8 @@ class Options {
/// that's to say the type of [Response.data] will be List<int>, use `bytes`
ResponseType? responseType;

/// `validateStatus` defines whether the request is successful for a given
/// HTTP response status code. If `validateStatus` returns `true` ,
/// [validateStatus] defines whether the request is successful for a given
/// HTTP response status code. If [validateStatus] returns `true` ,
/// the request will be perceived as successful; otherwise, considered as failed.
ValidateStatus? validateStatus;

Expand Down
2 changes: 1 addition & 1 deletion dio/lib/src/response.dart
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ class Response<T> {
Uri get realUri =>
redirects.isNotEmpty ? redirects.last.location : requestOptions.uri;

/// We are more concerned about `data` field.
/// We are more concerned about [data] field.
@override
String toString() {
if (data is Map) {
Expand Down
4 changes: 2 additions & 2 deletions dio/lib/src/transformer.dart
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@ import 'utils.dart';
/// request/response data, you can provide a [Transformer] by your self, and
/// replace the [DefaultTransformer] by setting the [dio.Transformer].
abstract class Transformer {
/// `transformRequest` allows changes to the request data before it is
/// [transformRequest] allows changes to the request data before it is
/// sent to the server, but **after** the [RequestInterceptor].
///
/// This is only applicable for request methods 'PUT', 'POST', and 'PATCH'
Future<String> transformRequest(RequestOptions options);

/// `transformResponse` allows changes to the response data before
/// [transformResponse] allows changes to the response data before
/// it is passed to [ResponseInterceptor].
///
/// **Note**: As an agreement, you must return the [response]
Expand Down

0 comments on commit 70cdbf9

Please sign in to comment.