Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix pub scores #1909

Merged
merged 8 commits into from
Jul 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion analysis_options.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ include: package:lints/recommended.yaml

analyzer:
errors:
deprecated_member_use_from_same_package: ignore
todo: ignore

linter:
Expand Down
1 change: 1 addition & 0 deletions dio/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ See the [Migration Guide][] for the complete breaking changes list.**

## Unreleased

- Improve package descriptions and code formats.
- Improve comments.
- Fix error when cloning `MultipartFile` from `FormData` with regression test.
- Deprecate `MulitpartFile` constructor in favor `MultipartFile.fromStream`.
Expand Down
6 changes: 3 additions & 3 deletions dio/README-ZH.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@

文档语言: 简体中文 | [English](README.md)

dio 是一个强大的 Dart HTTP 请求库,支持全局配置、Restful API、FormData、拦截器、
请求取消、Cookie 管理、文件上传/下载、超时以及自定义适配器等
dio 是一个强大的 HTTP 网络请求库,支持全局配置、Restful API、FormData、拦截器、
请求取消、Cookie 管理、文件上传/下载、超时、自定义适配器、转换器等

<details>
<summary>内容列表</summary>
Expand Down Expand Up @@ -46,7 +46,7 @@ dio 是一个强大的 Dart HTTP 请求库,支持全局配置、Restful API、
* [HTTP/2 支持](#http2-支持)
* [请求取消](#请求取消)
* [继承 Dio class](#继承-dio-class)
* [Web 平台跨域资源共享 (CORS)](#web-平台跨域资源共享--cors-)
* [Web 平台跨域资源共享 (CORS)](#web-平台跨域资源共享-cors)
<!-- TOC -->
</details>

Expand Down
11 changes: 6 additions & 5 deletions dio/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@

Language: English | [简体中文](README-ZH.md)

A powerful HTTP client for Dart/Flutter, which supports global configuration,
interceptors, FormData, request cancellation, file uploading/downloading,
timeout, and custom adapters etc.
A powerful HTTP networking package for Dart/Flutter,
supports Global configuration, Interceptors, FormData,
Request cancellation, File uploading/downloading,
Timeout, Custom adapters, Transformers, etc.

<details>
<summary>Table of content</summary>
Expand Down Expand Up @@ -37,7 +38,7 @@ timeout, and custom adapters etc.
* [Using application/x-www-form-urlencoded format](#using-applicationx-www-form-urlencoded-format)
* [Sending FormData](#sending-formdata)
* [Multiple files upload](#multiple-files-upload)
* [Reuse `FormData`s and `MultipartFile`s](#reuse-formdata-s-and-multipartfile-s)
* [Reuse `FormData`s and `MultipartFile`s](#reuse-formdatas-and-multipartfiles)
* [Transformer](#transformer)
* [In Flutter](#in-flutter)
* [Other example](#other-example)
Expand All @@ -47,7 +48,7 @@ timeout, and custom adapters etc.
* [HTTP/2 support](#http2-support)
* [Cancellation](#cancellation)
* [Extends Dio class](#extends-dio-class)
* [Cross-Origin Resource Sharing on Web (CORS)](#cross-origin-resource-sharing-on-web--cors-)
* [Cross-Origin Resource Sharing on Web (CORS)](#cross-origin-resource-sharing-on-web-cors)
<!-- TOC -->
</details>

Expand Down
3 changes: 1 addition & 2 deletions dio/lib/io.dart
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
export 'src/adapters/io_adapter.dart'
show DefaultHttpClientAdapter, IOHttpClientAdapter;
export 'src/adapters/io_adapter.dart' hide createAdapter;
export 'src/dio/dio_for_native.dart' show DioForNative;
10 changes: 4 additions & 6 deletions dio/lib/src/adapter.dart
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,11 @@ abstract class HttpClientAdapter {
/// the request body is not empty.
/// Use [requestStream] if your code rely on [RequestOptions.onSendProgress].
///
/// [cancelFuture] will be null when the [CancelToken]
/// is not set [CancelToken] for the request.
///
/// When the request is cancelled, [cancelFuture] will be resolved.
/// The adapter can listen cancel event like:
/// [cancelFuture] corresponds to [CancelToken] handling.
/// When the request is canceled, [cancelFuture] will be resolved.
/// To await if a request has been canceled:
/// ```dart
/// cancelFuture?.then((_)=>print("request cancelled!"))
/// cancelFuture?.then((_) => print('request cancelled!'));
/// ```
Future<ResponseBody> fetch(
RequestOptions options,
Expand Down
1 change: 1 addition & 0 deletions dio/lib/src/adapters/io_adapter.dart
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,7 @@ class IOHttpClientAdapter implements HttpClientAdapter {
return createHttpClient!();
}
final client = HttpClient()..idleTimeout = Duration(seconds: 3);
// ignore: deprecated_member_use, deprecated_member_use_from_same_package
return onHttpClientCreate?.call(client) ?? client;
}
}
5 changes: 3 additions & 2 deletions dio/lib/src/interceptor.dart
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,8 @@ class ErrorInterceptorHandler extends _BaseHandler {
}

/// [Interceptor] helps to deal with [RequestOptions], [Response],
/// and [DioError] during the lifecycle of a request before it reaches users.
/// and [DioException] during the lifecycle of a request
/// before it reaches users.
///
/// Interceptors are called once per request and response,
/// that means redirects aren't triggering interceptors.
Expand Down Expand Up @@ -342,7 +343,7 @@ class _TaskQueue<T, V extends _BaseHandler> {
class QueuedInterceptor extends Interceptor {
final _requestQueue = _TaskQueue<RequestOptions, RequestInterceptorHandler>();
final _responseQueue = _TaskQueue<Response, ResponseInterceptorHandler>();
final _errorQueue = _TaskQueue<DioError, ErrorInterceptorHandler>();
final _errorQueue = _TaskQueue<DioException, ErrorInterceptorHandler>();

void _handleRequest(
RequestOptions options,
Expand Down
9 changes: 4 additions & 5 deletions dio/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
name: dio

description: |
A powerful HTTP package for Dart/Flutter,
which supports Global settings, Interceptors,
FormData, Aborting and canceling a request,
Files uploading and downloading,
Requests timeout, Custom adapters, etc.
A powerful HTTP networking package,
supports Interceptors,
Aborting and canceling a request,
Custom adapters, Transformers, etc.
homepage: https://github.com/cfug/dio
repository: https://github.com/cfug/dio/blob/main/dio
issue_tracker: https://github.com/cfug/dio/issues
Expand Down
1 change: 1 addition & 0 deletions dio/test/adapters_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ void main() {
int onHttpClientCreateInvokeCount = 0;
final dio = Dio();
dio.httpClientAdapter = IOHttpClientAdapter(
// ignore: deprecated_member_use_from_same_package
onHttpClientCreate: (client) {
onHttpClientCreateInvokeCount++;
return client;
Expand Down
2 changes: 1 addition & 1 deletion plugins/cookie_manager/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: dio_cookie_manager
description: A cookie manager for Dio, which supports persistent cookies in RAM and file.
description: A cookie manager combines cookie_jar and dio, based on the interceptor algorithm.
version: 3.1.0
homepage: https://github.com/cfug/dio
repository: https://github.com/cfug/dio/blob/main/plugins/cookie_manager
Expand Down
2 changes: 1 addition & 1 deletion plugins/http2_adapter/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: dio_http2_adapter
description: A Dio HttpClientAdapter which support Http/2.0(Support connection reuse, header compression, server pushing is not supported yet.)
description: An adapter that combines HTTP/2 and dio. Supports reuse connections, header compression, etc.
version: 2.3.1
homepage: https://github.com/cfug/dio
repository: https://github.com/cfug/dio/blob/main/plugins/http2_adapter
Expand Down
Loading