From ab7bdc5ea575ffe576a00de9075c623ee5b7fd00 Mon Sep 17 00:00:00 2001 From: Peter Leibiger Date: Thu, 4 Apr 2024 01:08:18 +0200 Subject: [PATCH 1/5] Fix lints --- dio/lib/src/options.dart | 103 +++++++--------------- dio/test/utils.dart | 2 +- dio_test/lib/src/test/download_tests.dart | 2 +- example_flutter_app/lib/main.dart | 5 +- 4 files changed, 40 insertions(+), 72 deletions(-) diff --git a/dio/lib/src/options.dart b/dio/lib/src/options.dart index 8631b7135..e749caae0 100644 --- a/dio/lib/src/options.dart +++ b/dio/lib/src/options.dart @@ -136,43 +136,26 @@ mixin OptionsMixin { /// The base config for the Dio instance, used by [Dio.options]. class BaseOptions extends _RequestConfig with OptionsMixin { BaseOptions({ - String? method, + super.method, Duration? connectTimeout, - Duration? receiveTimeout, - Duration? sendTimeout, + super.receiveTimeout, + super.sendTimeout, String baseUrl = '', Map? queryParameters, - Map? extra, - Map? headers, - bool preserveHeaderCase = false, - ResponseType? responseType = ResponseType.json, - String? contentType, - ValidateStatus? validateStatus, - bool? receiveDataWhenStatusError, - bool? followRedirects, - int? maxRedirects, - bool? persistentConnection, - RequestEncoder? requestEncoder, - ResponseDecoder? responseDecoder, - ListFormat? listFormat, - }) : super( - method: method, - receiveTimeout: receiveTimeout, - sendTimeout: sendTimeout, - extra: extra, - headers: headers, - preserveHeaderCase: preserveHeaderCase, - responseType: responseType, - contentType: contentType, - validateStatus: validateStatus, - receiveDataWhenStatusError: receiveDataWhenStatusError, - followRedirects: followRedirects, - maxRedirects: maxRedirects, - persistentConnection: persistentConnection, - requestEncoder: requestEncoder, - responseDecoder: responseDecoder, - listFormat: listFormat, - ) { + super.extra, + super.headers, + super.preserveHeaderCase = false, + super.responseType = ResponseType.json, + super.contentType, + super.validateStatus, + super.receiveDataWhenStatusError, + super.followRedirects, + super.maxRedirects, + super.persistentConnection, + super.requestEncoder, + super.responseDecoder, + super.listFormat, + }) { this.baseUrl = baseUrl; this.queryParameters = queryParameters ?? {}; this.connectTimeout = connectTimeout; @@ -500,46 +483,28 @@ class RequestOptions extends _RequestConfig with OptionsMixin { this.onReceiveProgress, this.onSendProgress, this.cancelToken, - String? method, - Duration? sendTimeout, - Duration? receiveTimeout, + super.method, + super.sendTimeout, + super.receiveTimeout, Duration? connectTimeout, Map? queryParameters, String? baseUrl, - Map? extra, - Map? headers, - bool? preserveHeaderCase, - ResponseType? responseType, - String? contentType, - ValidateStatus? validateStatus, - bool? receiveDataWhenStatusError, - bool? followRedirects, - int? maxRedirects, - bool? persistentConnection, - RequestEncoder? requestEncoder, - ResponseDecoder? responseDecoder, - ListFormat? listFormat, + super.extra, + super.headers, + super.preserveHeaderCase, + super.responseType, + super.contentType, + super.validateStatus, + super.receiveDataWhenStatusError, + super.followRedirects, + super.maxRedirects, + super.persistentConnection, + super.requestEncoder, + super.responseDecoder, + super.listFormat, bool? setRequestContentTypeWhenNoPayload, StackTrace? sourceStackTrace, - }) : assert(connectTimeout == null || !connectTimeout.isNegative), - super( - method: method, - sendTimeout: sendTimeout, - receiveTimeout: receiveTimeout, - extra: extra, - headers: headers, - preserveHeaderCase: preserveHeaderCase, - responseType: responseType, - contentType: contentType, - validateStatus: validateStatus, - receiveDataWhenStatusError: receiveDataWhenStatusError, - followRedirects: followRedirects, - maxRedirects: maxRedirects, - persistentConnection: persistentConnection, - requestEncoder: requestEncoder, - responseDecoder: responseDecoder, - listFormat: listFormat, - ) { + }) : assert(connectTimeout == null || !connectTimeout.isNegative) { this.sourceStackTrace = sourceStackTrace ?? StackTrace.current; this.queryParameters = queryParameters ?? {}; this.baseUrl = baseUrl ?? ''; diff --git a/dio/test/utils.dart b/dio/test/utils.dart index 556e2cb6f..f4a06d0bc 100644 --- a/dio/test/utils.dart +++ b/dio/test/utils.dart @@ -173,7 +173,7 @@ final Matcher throwsDioExceptionConnectionError = throwsA( /// A stream of chunks of bytes representing a single piece of data. class ByteStream extends StreamView> { - ByteStream(Stream> stream) : super(stream); + ByteStream(super.stream); /// Returns a single-subscription byte stream that will emit the given bytes /// in a single chunk. diff --git a/dio_test/lib/src/test/download_tests.dart b/dio_test/lib/src/test/download_tests.dart index e0c60bbb5..2fdd23479 100644 --- a/dio_test/lib/src/test/download_tests.dart +++ b/dio_test/lib/src/test/download_tests.dart @@ -272,7 +272,7 @@ void downloadTests( }, // The download of the main.zip file can be slow, // so we need to increase the timeout. - timeout: Timeout(Duration(milliseconds: 1)), + timeout: Timeout(Duration(seconds: 1)), ); test('delete on error', () async { diff --git a/example_flutter_app/lib/main.dart b/example_flutter_app/lib/main.dart index 97bc8f2d0..9b6546258 100644 --- a/example_flutter_app/lib/main.dart +++ b/example_flutter_app/lib/main.dart @@ -24,7 +24,10 @@ class MyApp extends StatelessWidget { } class MyHomePage extends StatefulWidget { - MyHomePage({Key? key, this.title = ''}) : super(key: key); + MyHomePage({ + super.key, + this.title = '', + }); final String title; From d2e99d90486093e69728ff31a6a9689a0b26c394 Mon Sep 17 00:00:00 2001 From: Peter Leibiger Date: Thu, 4 Apr 2024 01:37:13 +0200 Subject: [PATCH 2/5] Disable Flutter action cache --- .github/workflows/tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 4c3a0f74e..73345a662 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -39,7 +39,7 @@ jobs: - uses: actions/checkout@v4 - uses: subosito/flutter-action@v2 with: - cache: true +# cache: true flutter-version: ${{ matrix.sdk == 'min' && '3.3.0' || '' }} channel: ${{ matrix.sdk == 'min' && '' || matrix.channel }} - run: dart pub get From e68abcbcd6ee986afb5a095a05ac71c1287fabba Mon Sep 17 00:00:00 2001 From: Peter Leibiger Date: Thu, 4 Apr 2024 01:47:30 +0200 Subject: [PATCH 3/5] Use older flutter action --- .github/workflows/tests.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 73345a662..1cc38b621 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -37,9 +37,9 @@ jobs: TEST_PRESET: all steps: - uses: actions/checkout@v4 - - uses: subosito/flutter-action@v2 + - uses: subosito/flutter-action@v2.13.0 with: -# cache: true + cache: true flutter-version: ${{ matrix.sdk == 'min' && '3.3.0' || '' }} channel: ${{ matrix.sdk == 'min' && '' || matrix.channel }} - run: dart pub get From c99858f5dd16e4c0208ddcc378a4785b5703f1aa Mon Sep 17 00:00:00 2001 From: Peter Leibiger Date: Thu, 4 Apr 2024 01:53:49 +0200 Subject: [PATCH 4/5] Try changing the workflow event --- .github/workflows/tests.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 1cc38b621..a88169314 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -7,7 +7,7 @@ on: - '6.0.0' paths-ignore: - "**.md" - pull_request_target: + pull_request: branches: - main - '6.0.0' @@ -41,7 +41,7 @@ jobs: with: cache: true flutter-version: ${{ matrix.sdk == 'min' && '3.3.0' || '' }} - channel: ${{ matrix.sdk == 'min' && '' || matrix.channel }} + channel: ${{ matrix.sdk == 'min' && 'stable' || matrix.channel }} - run: dart pub get - uses: bluefireteam/melos-action@v3 with: From 3ea15b0a6faad58142a3db2e0346dd354cb6b6b7 Mon Sep 17 00:00:00 2001 From: Peter Leibiger Date: Thu, 4 Apr 2024 01:57:24 +0200 Subject: [PATCH 5/5] Disable Flutter cache --- .github/workflows/tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index a88169314..1fecae071 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -39,7 +39,7 @@ jobs: - uses: actions/checkout@v4 - uses: subosito/flutter-action@v2.13.0 with: - cache: true +# cache: true flutter-version: ${{ matrix.sdk == 'min' && '3.3.0' || '' }} channel: ${{ matrix.sdk == 'min' && 'stable' || matrix.channel }} - run: dart pub get