From df2956e3ea98f4c297862a87c807c6397c716ee1 Mon Sep 17 00:00:00 2001 From: Brandon Trautmann <8343465+btrautmann@users.noreply.github.com> Date: Tue, 13 Jan 2026 15:20:30 -0500 Subject: [PATCH 1/6] chore: loosen dart constraint, allow down to 3.7.2 --- pubspec.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pubspec.yaml b/pubspec.yaml index 9ff818a..9dc7693 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -5,7 +5,7 @@ homepage: https://github.com/Betterment/sturdy_http repository: https://github.com/Betterment/sturdy_http environment: - sdk: '>=3.10.0 <4.0.0' + sdk: '>=3.7.2 <4.0.0' dependencies: collection: ^1.19.1 From c020be12f108ecaedd284d1525f6cdec40d13588 Mon Sep 17 00:00:00 2001 From: Brandon Trautmann <8343465+btrautmann@users.noreply.github.com> Date: Tue, 13 Jan 2026 15:24:47 -0500 Subject: [PATCH 2/6] chore: bump version --- pubspec.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pubspec.yaml b/pubspec.yaml index 9dc7693..75908fb 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,6 +1,6 @@ name: sturdy_http description: A strongly typed, event-based, reliable HTTP client that wraps `Dio`. -version: 0.6.1 +version: 0.6.2 homepage: https://github.com/Betterment/sturdy_http repository: https://github.com/Betterment/sturdy_http From f4db28c2015b790505859f3980158449cb1cd721 Mon Sep 17 00:00:00 2001 From: Brandon Trautmann <8343465+btrautmann@users.noreply.github.com> Date: Tue, 13 Jan 2026 17:09:49 -0500 Subject: [PATCH 3/6] chore: run formatter --- example/main.dart | 10 +++-- lib/src/sturdy_http.dart | 40 +++++++++-------- test/src/sturdy_http_test.dart | 79 ++++++++++++++++++---------------- 3 files changed, 70 insertions(+), 59 deletions(-) diff --git a/example/main.dart b/example/main.dart index b95faea..b0844dd 100644 --- a/example/main.dart +++ b/example/main.dart @@ -3,9 +3,13 @@ import 'package:sturdy_http/sturdy_http.dart'; void main(List args) async { // Set up some fake HTTP responses using Charlatan - final charlatan = Charlatan() - ..whenGet('/foo', (request) => CharlatanHttpResponse(body: 'Hello World!')) - ..whenPost('/foo', (request) => CharlatanHttpResponse(statusCode: 204)); + final charlatan = + Charlatan() + ..whenGet( + '/foo', + (request) => CharlatanHttpResponse(body: 'Hello World!'), + ) + ..whenPost('/foo', (request) => CharlatanHttpResponse(statusCode: 204)); // Create your client final client = SturdyHttp( diff --git a/lib/src/sturdy_http.dart b/lib/src/sturdy_http.dart index 067f74a..62bccba 100644 --- a/lib/src/sturdy_http.dart +++ b/lib/src/sturdy_http.dart @@ -77,12 +77,13 @@ class SturdyHttp { /// {@macro http_client} SturdyHttp withBaseUrl(String baseUrl) { return SturdyHttp._( - dio: Dio() - ..options.baseUrl = baseUrl - ..options.listFormat = ListFormat.multiCompatible - ..interceptors.addAll(_dio.interceptors) - ..interceptors.removeImplyContentTypeInterceptor() - ..httpClientAdapter = _dio.httpClientAdapter, + dio: + Dio() + ..options.baseUrl = baseUrl + ..options.listFormat = ListFormat.multiCompatible + ..interceptors.addAll(_dio.interceptors) + ..interceptors.removeImplyContentTypeInterceptor() + ..httpClientAdapter = _dio.httpClientAdapter, deserializer: _deserializer, eventListener: _eventListener, retryBehavior: _retryBehavior, @@ -147,9 +148,10 @@ class SturdyHttp { RawRequestBody(:final data) => data, }, queryParameters: request.queryParams, - options: request.options != null - ? request.options!.copyWith(method: request.type.name) - : Options(method: request.type.name), + options: + request.options != null + ? request.options!.copyWith(method: request.type.name) + : Options(method: request.type.name), cancelToken: request.cancelToken, onReceiveProgress: request.onReceiveProgress, onSendProgress: request.onSendProgress, @@ -160,12 +162,13 @@ class SturdyHttp { final data = dioResponse.data; if (data == null || data is! R) { String buildErrorMessage() { - final messageSuffix = data == null - // Disallow empty responses when status code is non-204 - ? 'was null and status code was ${dioResponse!.statusCode}' - // Enforce that response data matches expected, otherwise we'll run into casting - // issues below - : 'was of type ${data.runtimeType} when it should have been of type $R'; + final messageSuffix = + data == null + // Disallow empty responses when status code is non-204 + ? 'was null and status code was ${dioResponse!.statusCode}' + // Enforce that response data matches expected, otherwise we'll run into casting + // issues below + : 'was of type ${data.runtimeType} when it should have been of type $R'; return 'Request to ${request.path} was successful but response data $messageSuffix'; } @@ -272,9 +275,10 @@ Dio _configureDio({ }) { return Dio() // Instruct Dio to use the same Isolate approach as requested of SturdyHttp - ..transformer = deserializer is MainIsolateDeserializer - ? SyncTransformer() - : BackgroundTransformer() + ..transformer = + deserializer is MainIsolateDeserializer + ? SyncTransformer() + : BackgroundTransformer() ..options.baseUrl = baseUrl ..options.listFormat = ListFormat.multiCompatible ..interceptors.addAll(interceptors) diff --git a/test/src/sturdy_http_test.dart b/test/src/sturdy_http_test.dart index b56c4dd..0378cb6 100644 --- a/test/src/sturdy_http_test.dart +++ b/test/src/sturdy_http_test.dart @@ -338,9 +338,10 @@ void main() { OkResponse(:final response) => Success( Foo.fromMap(response), ), - GenericError() => throw Exception( - 'Decoding error in GenericError', - ), + GenericError() => + throw Exception( + 'Decoding error in GenericError', + ), _ => const Failure('Not expected: orElse'), }; }, @@ -925,22 +926,23 @@ void main() { return CharlatanHttpResponse(statusCode: 522); }); - final response = await buildSubject(retryBehavior: NeverRetry()) - .execute>( - const GetRequest( - defaultPath, - retryBehavior: Retry( - maxRetries: 2, - retryInterval: Duration(milliseconds: 100), - ), - ), - onResponse: (response) { - return switch (response) { - GenericError() => const Success(true), - _ => const Failure('Not expected: orElse'), - }; - }, - ); + final response = await buildSubject( + retryBehavior: NeverRetry(), + ).execute>( + const GetRequest( + defaultPath, + retryBehavior: Retry( + maxRetries: 2, + retryInterval: Duration(milliseconds: 100), + ), + ), + onResponse: (response) { + return switch (response) { + GenericError() => const Success(true), + _ => const Failure('Not expected: orElse'), + }; + }, + ); switch (response) { case Success(:final success): @@ -961,26 +963,27 @@ void main() { return CharlatanHttpResponse(statusCode: statusCode); }); - final response = await buildSubject(retryBehavior: NeverRetry()) - .execute>( - GetRequest( - defaultPath, - retryBehavior: Retry( - maxRetries: 2, - retryInterval: Duration(milliseconds: 100), - retryClause: (r) { - // Body will be `null`; essentially disallow retrying - return r != null; - }, - ), - ), - onResponse: (response) { - return switch (response) { - GenericError() => const Success(true), - _ => const Failure('Not expected: orElse'), - }; + final response = await buildSubject( + retryBehavior: NeverRetry(), + ).execute>( + GetRequest( + defaultPath, + retryBehavior: Retry( + maxRetries: 2, + retryInterval: Duration(milliseconds: 100), + retryClause: (r) { + // Body will be `null`; essentially disallow retrying + return r != null; }, - ); + ), + ), + onResponse: (response) { + return switch (response) { + GenericError() => const Success(true), + _ => const Failure('Not expected: orElse'), + }; + }, + ); switch (response) { case Success(:final success): From bcdeb8cf3c64b31777ae57e737864bb52e2dab86 Mon Sep 17 00:00:00 2001 From: Brandon Trautmann <8343465+btrautmann@users.noreply.github.com> Date: Tue, 13 Jan 2026 17:10:23 -0500 Subject: [PATCH 4/6] chore: change CI dart version --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d2cad43..95dc921 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -12,7 +12,7 @@ on: branches: [main] env: - DART_VERSION: 3.10.4 + DART_VERSION: 3.7.2 jobs: ci: From 83d46f0894d3b1b50dd04e09c464d547bffe3a61 Mon Sep 17 00:00:00 2001 From: Brandon Trautmann <8343465+btrautmann@users.noreply.github.com> Date: Tue, 13 Jan 2026 17:12:57 -0500 Subject: [PATCH 5/6] chore: address dependency conflicts --- pubspec.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pubspec.yaml b/pubspec.yaml index 75908fb..f40ed80 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -14,5 +14,5 @@ dependencies: dev_dependencies: charlatan: ^0.5.0 - lints: ^6.0.0 - test: ^1.28.0 + lints: ^5.1.1 + test: ^1.29.0 From 5310cbccd29bf84b3b12c62c559887530520aec8 Mon Sep 17 00:00:00 2001 From: Brandon Trautmann <8343465+btrautmann@users.noreply.github.com> Date: Wed, 14 Jan 2026 09:09:47 -0500 Subject: [PATCH 6/6] chore: remove version change, will do that in next PR --- pubspec.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pubspec.yaml b/pubspec.yaml index f40ed80..d968d0d 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,6 +1,6 @@ name: sturdy_http description: A strongly typed, event-based, reliable HTTP client that wraps `Dio`. -version: 0.6.2 +version: 0.6.1 homepage: https://github.com/Betterment/sturdy_http repository: https://github.com/Betterment/sturdy_http