From 1b27090032a1cd0a61e2d5c208fa7c46b364b89f Mon Sep 17 00:00:00 2001 From: Joshua Mayanja Date: Tue, 15 Sep 2026 16:33:00 +0300 Subject: [PATCH 1/8] Swap hive for hive_ce (2.x) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit hive is unmaintained; hive_ce is the actively-maintained community continuation, API-compatible for everything this package uses (Box, HiveInterface, registerAdapter/isAdapterRegistered, HiveAesCipher). Two source changes beyond the import swap: - hive_ce's TypeAdapter is a plain `abstract class` analyzed at Dart 3.4+ language version (hive's own copy of the same class stayed mixin-usable only because hive itself pins language version <3.0). HiveLocalAdapter now `implements TypeAdapter` instead of `with TypeAdapter` — safe, since TypeAdapter has no concrete methods to inherit, only abstract members HiveLocalAdapter already implements. - test/mocks.dart's internal-path imports (default_compaction_strategy .dart, default_key_comparator.dart) still resolve under hive_ce at the same paths. `dart analyze` is clean. Could not run the test suite in this environment (local Dart SDK is missing frontend_server.dart.snapshot, unrelated to this change) — run `dart test` in CI/a complete toolchain before relying on this. --- example/pubspec.lock | 22 +++++++++++----------- lib/flutter_data.dart | 2 +- lib/src/repository/hive_local_adapter.dart | 2 +- lib/src/repository/hive_local_storage.dart | 2 +- pubspec.lock | 22 +++++++++++----------- pubspec.yaml | 2 +- test/mocks.dart | 6 +++--- test/repository/local_storage_test.dart | 2 +- 8 files changed, 30 insertions(+), 30 deletions(-) diff --git a/example/pubspec.lock b/example/pubspec.lock index d309de7a..ff61891b 100644 --- a/example/pubspec.lock +++ b/example/pubspec.lock @@ -208,22 +208,22 @@ packages: url: "https://pub.dev" source: hosted version: "2.3.1" - hive: + hive_ce: dependency: transitive description: - name: hive - sha256: "8dcf6db979d7933da8217edcec84e9df1bdb4e4edc7fc77dbd5aa74356d6d941" + name: hive_ce + sha256: f81eb3dcfd894f07e23c29aa12640f4001218d9a83b4f880d71febfd400218b0 url: "https://pub.dev" source: hosted - version: "2.2.3" + version: "2.4.4" http: dependency: transitive description: name: http - sha256: a2bbf9d017fcced29139daa8ed2bba4ece450ab222871df93ca9eec6f80c34ba + sha256: "87721a4a50b19c7f1d49001e51409bddc46303966ce89a65af4f4e6004896412" url: "https://pub.dev" source: hosted - version: "1.2.0" + version: "1.6.0" http_multi_server: dependency: transitive description: @@ -516,18 +516,18 @@ packages: dependency: transitive description: name: web - sha256: "4188706108906f002b3a293509234588823c8c979dc83304e229ff400c996b05" + sha256: "868d88a33d8a87b18ffc05f9f030ba328ffefba92d6c127917a2ba740f9cfe4a" url: "https://pub.dev" source: hosted - version: "0.4.2" + version: "1.1.1" web_socket_channel: dependency: transitive description: name: web_socket_channel - sha256: "939ab60734a4f8fa95feacb55804fa278de28bdeef38e616dc08e44a84adea23" + sha256: d88238e5eac9a42bb43ca4e721edba3c08c6354d4a53063afaa568516217621b url: "https://pub.dev" source: hosted - version: "2.4.3" + version: "2.4.0" yaml: dependency: transitive description: @@ -537,4 +537,4 @@ packages: source: hosted version: "3.1.2" sdks: - dart: ">=3.2.0 <4.0.0" + dart: ">=3.4.0 <4.0.0" diff --git a/lib/flutter_data.dart b/lib/flutter_data.dart index fd365b87..0bcbab12 100644 --- a/lib/flutter_data.dart +++ b/lib/flutter_data.dart @@ -8,7 +8,7 @@ import 'dart:typed_data'; import 'package:collection/collection.dart'; import 'package:equatable/equatable.dart'; -import 'package:hive/hive.dart'; +import 'package:hive_ce/hive.dart'; import 'package:http/http.dart' as http; import 'package:inflection3/inflection3.dart' as inflection; import 'package:meta/meta.dart'; diff --git a/lib/src/repository/hive_local_adapter.dart b/lib/src/repository/hive_local_adapter.dart index 22ded0bd..9d25a510 100644 --- a/lib/src/repository/hive_local_adapter.dart +++ b/lib/src/repository/hive_local_adapter.dart @@ -3,7 +3,7 @@ part of flutter_data; /// Hive implementation of [LocalAdapter] and Hive's [TypeAdapter]. // ignore: must_be_immutable abstract class HiveLocalAdapter> - extends LocalAdapter with TypeAdapter { + extends LocalAdapter implements TypeAdapter { HiveLocalAdapter(Ref ref, {int? typeId}) : _typeId = typeId, _hiveLocalStorage = ref.read(hiveLocalStorageProvider), diff --git a/lib/src/repository/hive_local_storage.dart b/lib/src/repository/hive_local_storage.dart index 1a94604f..520c1e5b 100644 --- a/lib/src/repository/hive_local_storage.dart +++ b/lib/src/repository/hive_local_storage.dart @@ -1,7 +1,7 @@ import 'dart:async'; import 'package:flutter_data/flutter_data.dart'; -import 'package:hive/hive.dart'; +import 'package:hive_ce/hive.dart'; import 'package:path/path.dart' as path_helper; import 'package:recase/recase.dart'; diff --git a/pubspec.lock b/pubspec.lock index bba4445b..f3fb566c 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -241,14 +241,14 @@ packages: url: "https://pub.dev" source: hosted version: "2.3.1" - hive: + hive_ce: dependency: "direct main" description: - name: hive - sha256: "8dcf6db979d7933da8217edcec84e9df1bdb4e4edc7fc77dbd5aa74356d6d941" + name: hive_ce + sha256: f81eb3dcfd894f07e23c29aa12640f4001218d9a83b4f880d71febfd400218b0 url: "https://pub.dev" source: hosted - version: "2.2.3" + version: "2.4.4" html: dependency: transitive description: @@ -261,10 +261,10 @@ packages: dependency: "direct main" description: name: http - sha256: a2bbf9d017fcced29139daa8ed2bba4ece450ab222871df93ca9eec6f80c34ba + sha256: "87721a4a50b19c7f1d49001e51409bddc46303966ce89a65af4f4e6004896412" url: "https://pub.dev" source: hosted - version: "1.2.0" + version: "1.6.0" http_multi_server: dependency: transitive description: @@ -645,18 +645,18 @@ packages: dependency: transitive description: name: web - sha256: "4188706108906f002b3a293509234588823c8c979dc83304e229ff400c996b05" + sha256: "868d88a33d8a87b18ffc05f9f030ba328ffefba92d6c127917a2ba740f9cfe4a" url: "https://pub.dev" source: hosted - version: "0.4.2" + version: "1.1.1" web_socket_channel: dependency: transitive description: name: web_socket_channel - sha256: "939ab60734a4f8fa95feacb55804fa278de28bdeef38e616dc08e44a84adea23" + sha256: d88238e5eac9a42bb43ca4e721edba3c08c6354d4a53063afaa568516217621b url: "https://pub.dev" source: hosted - version: "2.4.3" + version: "2.4.0" webkit_inspection_protocol: dependency: transitive description: @@ -674,4 +674,4 @@ packages: source: hosted version: "3.1.2" sdks: - dart: ">=3.2.0 <4.0.0" + dart: ">=3.4.0 <4.0.0" diff --git a/pubspec.yaml b/pubspec.yaml index b73c6984..c6bb2cce 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -18,7 +18,7 @@ dependencies: crypto: ^3.0.1 equatable: ^2.0.2 glob: ^2.0.1 - hive: ^2.2.3 + hive_ce: ^2.0.0 http: ^1.2.0 inflection3: ^0.5.3+2 json_annotation: ^4.8.1 diff --git a/test/mocks.dart b/test/mocks.dart index c47e5508..19dc66b2 100644 --- a/test/mocks.dart +++ b/test/mocks.dart @@ -1,9 +1,9 @@ import 'dart:async'; import 'dart:typed_data'; -import 'package:hive/hive.dart'; -import 'package:hive/src/box/default_compaction_strategy.dart'; -import 'package:hive/src/box/default_key_comparator.dart'; +import 'package:hive_ce/hive.dart'; +import 'package:hive_ce/src/box/default_compaction_strategy.dart'; +import 'package:hive_ce/src/box/default_key_comparator.dart'; import 'package:mockito/mockito.dart'; class FakeBox extends Fake implements Box { diff --git a/test/repository/local_storage_test.dart b/test/repository/local_storage_test.dart index 9ecd270b..59de369b 100644 --- a/test/repository/local_storage_test.dart +++ b/test/repository/local_storage_test.dart @@ -5,7 +5,7 @@ import 'dart:io'; import 'package:flutter_data/flutter_data.dart'; -import 'package:hive/hive.dart'; +import 'package:hive_ce/hive.dart'; import 'package:test/test.dart'; import '../mocks.dart'; From d9906b36e35f06a273353b9e09548fa210be69ec Mon Sep 17 00:00:00 2001 From: Joshua Mayanja Date: Tue, 15 Sep 2026 16:44:24 +0300 Subject: [PATCH 2/8] Add CI job to verify codegen against a current build_runner MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Isolated from any other codegen package (riverpod_generator, etc.) a consuming app might also carry — this only proves flutter_data's own builders (data_library_builder, repository_builder) still generate correctly on their own. A consuming app's build_runner failure with other generators in the mix is a separate problem in that app's own dependency graph, not evidence against this fork. Also bumped example/'s own SDK floor to match flutter_data's (Dart 3.4+, required by hive_ce) and its build_runner/json_serializable constraints to current. --- .github/workflows/test.yml | 24 ++++++++++++++++++++++++ example/pubspec.yaml | 6 +++--- 2 files changed, 27 insertions(+), 3 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 5f3511af..d8c83886 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -45,3 +45,27 @@ jobs: uses: codecov/codecov-action@v1 with: token: ${{ secrets.CODECOV_TOKEN }} + + # Verifies flutter_data's own builders (data_library_builder, + # repository_builder) still generate against a current build_runner, + # in isolation from any other codegen package (riverpod_generator etc.) + # a consuming app might also have in its graph. Apps that see + # build_runner fail with those combined shouldn't read that as this + # fork's codegen being broken — see whether the failure survives + # without flutter_data in the mix before assuming this fork is at fault. + codegen: + runs-on: ubuntu-latest + steps: + - uses: dart-lang/setup-dart@v1.5 + - uses: actions/checkout@v2 + - name: Install dependencies (root) + run: dart pub get + - name: Install dependencies (example) + working-directory: example + run: dart pub get + - name: Generate + working-directory: example + run: dart run build_runner build --delete-conflicting-outputs + - name: Fail if generation produced no output + working-directory: example + run: test -f lib/main.data.dart || (echo "::error::main.data.dart was not generated" && exit 1) diff --git a/example/pubspec.yaml b/example/pubspec.yaml index e2730564..50bb0be4 100644 --- a/example/pubspec.yaml +++ b/example/pubspec.yaml @@ -4,7 +4,7 @@ version: 1.0.0+1 publish_to: none environment: - sdk: ">=2.17.1 <3.0.0" + sdk: ">=3.4.0 <4.0.0" dependencies: flutter_data: @@ -12,5 +12,5 @@ dependencies: json_annotation: ^4.8.0 dev_dependencies: - build_runner: ^2.0.4 - json_serializable: ^6.1.3 + build_runner: ^2.6.0 + json_serializable: ^6.11.1 From 5bc43953ed6cc8df842bea0a5b2914d4c6c5ee3a Mon Sep 17 00:00:00 2001 From: Joshua Mayanja Date: Tue, 15 Sep 2026 16:56:06 +0300 Subject: [PATCH 3/8] Widen build-time dependency constraints to unblock current SDKs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The real ask behind this: apps depending on flutter_data were stuck pinning old analyzer/build/build_runner/freezed to satisfy flutter_data's narrow lower-bounds, which in turn blocked those apps from moving to a current Dart/Flutter SDK. Widened every build-time constraint (analyzer, build, source_gen, riverpod) to a broad range instead of a narrow caret, and bumped freezed 2.x->3.x (dev-only, test fixtures). Removed build_resolvers and build_test as explicit dependencies — grep confirmed neither is imported anywhere in lib/ or test/; declaring them narrowed the graph for consumers with nothing to show for it. (build_test is also stuck depending on build ^2.0.0 across its entire published history, and build_resolvers is pub.dev-flagged discontinued.) Resolving against these wider ranges landed analyzer 6.1.0 -> 8.4.1 and source_gen 1.0.1 -> 4.2.0, which is the actual jump apps get once they can stop overriding versions by hand. That surfaced 6 real API changes in the three files that touch analyzer/source_gen directly: - TypeChecker.fromRuntime -> TypeChecker.typeNamed (removed upstream in source_gen; same call shape, straight rename) - Element.location -> element.library!.uri (location was removed in analyzer 8's Element model; library.uri gives the same "package:..." string the old .location.components.first did) - ConstructorElement.parameters -> .formalParameters, returning FormalParameterElement (renamed as part of the same Element model pass) - Element.name is now nullable (String?) throughout; added `!` at the four call sites operating on elements that always have a declared name (fields, methods, params) rather than threading optionality through - getDisplayString(withNullability: false) -> getDisplayString() (the parameter was removed now that non-nullable-by-default is the only mode) dart analyze is clean across lib/, test/, and example/lib/ against the newly-resolved versions (analyzer 8.4.1, source_gen 4.2.0, build_runner 2.6.1, freezed 3.2.3). Test suite and the codegen CI job both still need the pending Actions-enable click to actually run — see PR #1. --- example/pubspec.lock | 130 ++++++------------------- lib/builders/data_library_builder.dart | 4 +- lib/builders/repository_builder.dart | 20 ++-- lib/builders/utils.dart | 10 +- pubspec.lock | 98 +++++++++---------- pubspec.yaml | 16 ++- 6 files changed, 102 insertions(+), 176 deletions(-) diff --git a/example/pubspec.lock b/example/pubspec.lock index ff61891b..b944c820 100644 --- a/example/pubspec.lock +++ b/example/pubspec.lock @@ -5,26 +5,26 @@ packages: dependency: transitive description: name: _fe_analyzer_shared - sha256: "0b2f2bd91ba804e53a61d757b986f89f1f9eaed5b11e4b2f5a2468d86d6c9fc7" + sha256: fdcd9f70f9eb80df3bc5ed0fa67280df2595fd481948df8a9ab082e6a40ad04b url: "https://pub.dev" source: hosted - version: "67.0.0" + version: "108.0.0" analyzer: dependency: transitive description: name: analyzer - sha256: "37577842a27e4338429a1cbc32679d508836510b056f1eedf0c8d20e39c1383d" + sha256: a51c769bff3b6dfbe9d60199b8606d808290702a296bef0c26a4ca391d414e46 url: "https://pub.dev" source: hosted - version: "6.4.1" + version: "14.4.0" args: dependency: transitive description: name: args - sha256: eef6c46b622e0494a36c5a12d10d77fb4e855501a91c1b9ef9339326e58f0596 + sha256: d0481093c50b1da8910eb0bb301626d4d8eb7284aa739614d2b394ee09e3ea04 url: "https://pub.dev" source: hosted - version: "2.4.2" + version: "2.7.0" async: dependency: transitive description: @@ -33,30 +33,22 @@ packages: url: "https://pub.dev" source: hosted version: "2.11.0" - boolean_selector: - dependency: transitive - description: - name: boolean_selector - sha256: "6cfb5af12253eaf2b368f07bacc5a80d1301a071c73360d746b7f2e32d762c66" - url: "https://pub.dev" - source: hosted - version: "2.1.1" build: dependency: transitive description: name: build - sha256: "80184af8b6cb3e5c1c4ec6d8544d27711700bc3e6d2efad04238c7b5290889f0" + sha256: "8a5c5761af8e31748bba3c82f68925ace40f3225c3eea25be9beb57eca7cd7a8" url: "https://pub.dev" source: hosted - version: "2.4.1" + version: "4.0.11" build_config: dependency: transitive description: name: build_config - sha256: bf80fcfb46a29945b423bd9aad884590fb1dc69b330a4d4700cac476af1708d1 + sha256: d466ed2dc9c6cd1d169948879b84ee061eb5e22c64a7c6089879c6296d272a8d url: "https://pub.dev" source: hosted - version: "1.1.1" + version: "1.3.3" build_daemon: dependency: transitive description: @@ -65,30 +57,14 @@ packages: url: "https://pub.dev" source: hosted version: "4.0.1" - build_resolvers: - dependency: transitive - description: - name: build_resolvers - sha256: "339086358431fa15d7eca8b6a36e5d783728cf025e559b834f4609a1fcfb7b0a" - url: "https://pub.dev" - source: hosted - version: "2.4.2" build_runner: dependency: "direct dev" description: name: build_runner - sha256: "581bacf68f89ec8792f5e5a0b2c4decd1c948e97ce659dc783688c8a88fbec21" + sha256: "894c243f6bc32015fec466ce30a6925bd537a77a426ee5bf481120477eb3de67" url: "https://pub.dev" source: hosted - version: "2.4.8" - build_runner_core: - dependency: transitive - description: - name: build_runner_core - sha256: "4ae8ffe5ac758da294ecf1802f2aff01558d8b1b00616aa7538ea9a8a5d50799" - url: "https://pub.dev" - source: hosted - version: "7.3.0" + version: "2.16.1" built_collection: dependency: transitive description: @@ -101,10 +77,10 @@ packages: dependency: transitive description: name: built_value - sha256: fedde275e0a6b798c3296963c5cd224e3e1b55d0e478d5b7e65e6b540f363a0e + sha256: f87ea98192116f7093cb214551ce1929caae0681fdba282b3d8b4462adee7bb7 url: "https://pub.dev" source: hosted - version: "8.9.1" + version: "8.13.0" checked_yaml: dependency: transitive description: @@ -113,22 +89,14 @@ packages: url: "https://pub.dev" source: hosted version: "2.0.3" - code_builder: - dependency: transitive - description: - name: code_builder - sha256: f692079e25e7869c14132d39f223f8eec9830eb76131925143b2129c4bb01b37 - url: "https://pub.dev" - source: hosted - version: "4.10.0" collection: dependency: transitive description: name: collection - sha256: ee67cb0715911d28db6bf4af1026078bd6f0128b07a5f66fb2ed94ec6783c09a + sha256: "2f5709ae4d3d59dd8f7cd309b4e023046b57d8a6c82130785d2b0e5868084e76" url: "https://pub.dev" source: hosted - version: "1.18.0" + version: "1.19.1" convert: dependency: transitive description: @@ -149,10 +117,10 @@ packages: dependency: transitive description: name: dart_style - sha256: "40ae61a5d43feea6d24bd22c0537a6629db858963b99b4bc1c3db80676f32368" + sha256: "82ade9fc4273f29ed673e33166944465225b4f7fc5d4aaef48605cc751c18fc1" url: "https://pub.dev" source: hosted - version: "2.3.4" + version: "3.1.13" equatable: dependency: transitive description: @@ -184,14 +152,6 @@ packages: relative: true source: path version: "1.6.0" - frontend_server_client: - dependency: transitive - description: - name: frontend_server_client - sha256: "408e3ca148b31c20282ad6f37ebfa6f4bdc8fede5b74bc2f08d9d92b55db3612" - url: "https://pub.dev" - source: hosted - version: "3.2.0" glob: dependency: transitive description: @@ -256,30 +216,22 @@ packages: url: "https://pub.dev" source: hosted version: "1.0.4" - js: - dependency: transitive - description: - name: js - sha256: c1b2e9b5ea78c45e1a0788d29606ba27dc5f71f019f32ca5140f61ef071838cf - url: "https://pub.dev" - source: hosted - version: "0.7.1" json_annotation: dependency: "direct main" description: name: json_annotation - sha256: b10a7b2ff83d83c777edba3c6a0f97045ddadd56c944e1a23a3fdf43a1bf4467 + sha256: "2a743920d81b7910627f68ee2c9ac1fc0bfee32b9fc3403587d7c6791ca12f80" url: "https://pub.dev" source: hosted - version: "4.8.1" + version: "4.12.0" json_serializable: dependency: "direct dev" description: name: json_serializable - sha256: aa1f5a8912615733e0fdc7a02af03308933c93235bdc8d50d0b0c8a8ccb0b969 + sha256: e45aefa0324f08c683caafbb94b72837aa6193c61822799c916e45f4a263113d url: "https://pub.dev" source: hosted - version: "6.7.1" + version: "6.14.1" logging: dependency: transitive description: @@ -288,22 +240,14 @@ packages: url: "https://pub.dev" source: hosted version: "1.2.0" - matcher: - dependency: transitive - description: - name: matcher - sha256: d2323aa2060500f906aa31a895b4030b6da3ebdcc5619d14ce1aada65cd161cb - url: "https://pub.dev" - source: hosted - version: "0.12.16+1" meta: dependency: transitive description: name: meta - sha256: "7687075e408b093f36e6bbf6c91878cc0d4cd10f409506f7bc996f68220b9136" + sha256: "307249ce4ff29d58a18e97f6345f539382eb9c9c29ecda628900f31de0443dd9" url: "https://pub.dev" source: hosted - version: "1.12.0" + version: "1.19.0" mime: dependency: transitive description: @@ -396,18 +340,18 @@ packages: dependency: transitive description: name: source_gen - sha256: "14658ba5f669685cd3d63701d01b31ea748310f7ab854e471962670abcf57832" + sha256: "11b6047da8e4eb6c643ccac3d0fda3f9c9e11651695f7da24a85ade8aff15a44" url: "https://pub.dev" source: hosted - version: "1.5.0" + version: "4.3.0" source_helper: dependency: transitive description: name: source_helper - sha256: "6adebc0006c37dd63fe05bca0a929b99f06402fc95aa35bf36d67f5c06de01fd" + sha256: "5e6f216fdf6376c9f3852381ae037499797a3385377d388b011dac98d303c67c" url: "https://pub.dev" source: hosted - version: "1.3.4" + version: "1.3.13" source_span: dependency: transitive description: @@ -472,22 +416,6 @@ packages: url: "https://pub.dev" source: hosted version: "1.2.1" - test_api: - dependency: transitive - description: - name: test_api - sha256: "9955ae474176f7ac8ee4e989dadfb411a58c30415bcfb648fa04b2b8a03afa7f" - url: "https://pub.dev" - source: hosted - version: "0.7.0" - timing: - dependency: transitive - description: - name: timing - sha256: "70a3b636575d4163c477e6de42f247a23b315ae20e86442bebe32d3cabf61c32" - url: "https://pub.dev" - source: hosted - version: "1.0.1" typed_data: dependency: transitive description: @@ -537,4 +465,4 @@ packages: source: hosted version: "3.1.2" sdks: - dart: ">=3.4.0 <4.0.0" + dart: ">=3.11.0 <4.0.0" diff --git a/lib/builders/data_library_builder.dart b/lib/builders/data_library_builder.dart index 49f3622c..ccedd032 100644 --- a/lib/builders/data_library_builder.dart +++ b/lib/builders/data_library_builder.dart @@ -24,7 +24,7 @@ class DataExtensionIntermediateBuilder implements Builder { if (!await resolver.isLibrary(buildStep.inputId)) return; final lib = LibraryReader(await buildStep.inputLibrary); - final annotation = TypeChecker.fromRuntime(DataRepository); + final annotation = TypeChecker.typeNamed(DataRepository); final members = [ for (final member in lib.annotatedWith(annotation)) member, ]; @@ -38,7 +38,7 @@ class DataExtensionIntermediateBuilder implements Builder { member.annotation.read('internalType').isNull ? DataHelpers.internalTypeFor(member.element.name!) : member.annotation.read('internalType').stringValue, - member.element.location!.components.first, + member.element.library!.uri.toString(), member.annotation.read('remote').boolValue, ].join('#'); }).join(';')); diff --git a/lib/builders/repository_builder.dart b/lib/builders/repository_builder.dart index 96853b1e..3dac0cb2 100644 --- a/lib/builders/repository_builder.dart +++ b/lib/builders/repository_builder.dart @@ -31,7 +31,7 @@ class RepositoryGenerator extends GeneratorForAnnotation { "Can't generate repository for $className. Please use @DataRepository on a class."); } - final annot = TypeChecker.fromRuntime(JsonSerializable); + final annot = TypeChecker.typeNamed(JsonSerializable); var fieldRename = annot .firstAnnotationOfExact(classElement, throwOnUnresolved: false) @@ -67,9 +67,9 @@ class RepositoryGenerator extends GeneratorForAnnotation { .fold>>({}, (result, field) { final relationshipClassElement = field.typeElement; - final relationshipAnnotation = TypeChecker.fromRuntime(DataRelationship) + final relationshipAnnotation = TypeChecker.typeNamed(DataRelationship) .firstAnnotationOfExact(field, throwOnUnresolved: false); - final jsonKeyAnnotation = TypeChecker.fromRuntime(JsonKey) + final jsonKeyAnnotation = TypeChecker.typeNamed(JsonKey) .firstAnnotationOfExact(field, throwOnUnresolved: false); final jsonKeyIgnored = @@ -129,13 +129,13 @@ and execute a code generation build again. final fieldCase = fieldRename.getField('_name')?.toStringValue(); switch (fieldCase) { case 'kebab': - keyName = field.name.kebab; + keyName = field.name!.kebab; break; case 'snake': - keyName = field.name.snake; + keyName = field.name!.snake; break; case 'pascal': - keyName = field.name.pascal; + keyName = field.name!.pascal; break; case 'none': keyName = field.name; @@ -230,14 +230,14 @@ RelationshipGraphNode<${rel['type']}> get ${rel['name']} { nullabilitySuffix: NullabilitySuffix.none); mixinMethods.addAll(instantiatedMixinType.methods); displayName = - instantiatedMixinType.getDisplayString(withNullability: false); + instantiatedMixinType.getDisplayString(); // add finders for (final field in mixinMethods) { final hasFinderAnnotation = - TypeChecker.fromRuntime(DataFinder).hasAnnotationOfExact(field); + TypeChecker.typeNamed(DataFinder).hasAnnotationOfExact(field); if (hasFinderAnnotation) { - finders.add(field.name); + finders.add(field.name!); } } @@ -262,7 +262,7 @@ RelationshipGraphNode<${rel['type']}> get ${rel['name']} { nullabilitySuffix: NullabilitySuffix.none); mixinMethods.addAll(instantiatedMixinType.methods); displayName = - instantiatedMixinType.getDisplayString(withNullability: false); + instantiatedMixinType.getDisplayString(); return displayName; }).toSet(); diff --git a/lib/builders/utils.dart b/lib/builders/utils.dart index c34731e1..2c5604d8 100644 --- a/lib/builders/utils.dart +++ b/lib/builders/utils.dart @@ -5,8 +5,8 @@ import 'package:flutter_data/flutter_data.dart'; import 'package:pubspec_parse/pubspec_parse.dart'; import 'package:source_gen/source_gen.dart'; -final relationshipTypeChecker = TypeChecker.fromRuntime(Relationship); -final dataModelTypeChecker = TypeChecker.fromRuntime(DataModelMixin); +final relationshipTypeChecker = TypeChecker.typeNamed(Relationship); +final dataModelTypeChecker = TypeChecker.typeNamed(DataModelMixin); extension ClassElementX on ClassElement { ConstructorElement? get freezedConstructor => constructors @@ -24,13 +24,13 @@ extension ClassElementX on ClassElement { field.isPublic && (field.type.element as ClassElement).supertype != null && relationshipTypeChecker.isSuperOf(field.type.element!)) - field.name: field, + field.name!: field, // also check freezed if (freezedConstructor != null) - for (final param in freezedConstructor!.parameters) + for (final param in freezedConstructor!.formalParameters) if (param.type.element != null && relationshipTypeChecker.isSuperOf(param.type.element!)) - param.name: param, + param.name!: param, }; return map.values.toList(); diff --git a/pubspec.lock b/pubspec.lock index f3fb566c..67d8366a 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -5,18 +5,18 @@ packages: dependency: transitive description: name: _fe_analyzer_shared - sha256: "0b2f2bd91ba804e53a61d757b986f89f1f9eaed5b11e4b2f5a2468d86d6c9fc7" + sha256: c209688d9f5a5f26b2fb47a188131a6fb9e876ae9e47af3737c0b4f58a93470d url: "https://pub.dev" source: hosted - version: "67.0.0" + version: "91.0.0" analyzer: dependency: "direct main" description: name: analyzer - sha256: "37577842a27e4338429a1cbc32679d508836510b056f1eedf0c8d20e39c1383d" + sha256: f51c8499b35f9b26820cfe914828a6a98a94efd5cc78b37bb7d03debae3a1d08 url: "https://pub.dev" source: hosted - version: "6.4.1" + version: "8.4.1" args: dependency: transitive description: @@ -45,10 +45,10 @@ packages: dependency: "direct main" description: name: build - sha256: "80184af8b6cb3e5c1c4ec6d8544d27711700bc3e6d2efad04238c7b5290889f0" + sha256: "7174c5d84b0fed00a1f5e7543597b35d67560465ae3d909f0889b8b20419d5e3" url: "https://pub.dev" source: hosted - version: "2.4.1" + version: "3.0.1" build_config: dependency: transitive description: @@ -66,37 +66,37 @@ packages: source: hosted version: "4.0.1" build_resolvers: - dependency: "direct main" + dependency: transitive description: name: build_resolvers - sha256: "339086358431fa15d7eca8b6a36e5d783728cf025e559b834f4609a1fcfb7b0a" + sha256: "82730bf3d9043366ba8c02e4add05842a10739899520a6a22ddbd22d333bd5bb" url: "https://pub.dev" source: hosted - version: "2.4.2" + version: "3.0.1" build_runner: dependency: "direct dev" description: name: build_runner - sha256: "581bacf68f89ec8792f5e5a0b2c4decd1c948e97ce659dc783688c8a88fbec21" + sha256: "32c6b3d172f1f46b7c4df6bc4a47b8d88afb9e505dd4ace4af80b3c37e89832b" url: "https://pub.dev" source: hosted - version: "2.4.8" + version: "2.6.1" build_runner_core: dependency: transitive description: name: build_runner_core - sha256: "4ae8ffe5ac758da294ecf1802f2aff01558d8b1b00616aa7538ea9a8a5d50799" + sha256: "4b188774b369104ad96c0e4ca2471e5162f0566ce277771b179bed5eabf2d048" url: "https://pub.dev" source: hosted - version: "7.3.0" + version: "9.2.1" build_test: - dependency: "direct dev" + dependency: transitive description: name: build_test - sha256: "260dbba934f41b0a42935e9cae1f5731b94f0c3e489dc97bcf8e281265aaa5ae" + sha256: "9d511df25dd44ed54f41fbc366958748388b07ca167cb667052a4f6dd0c02535" url: "https://pub.dev" source: hosted - version: "2.2.2" + version: "3.3.1" built_collection: dependency: transitive description: @@ -109,10 +109,10 @@ packages: dependency: transitive description: name: built_value - sha256: fedde275e0a6b798c3296963c5cd224e3e1b55d0e478d5b7e65e6b540f363a0e + sha256: f87ea98192116f7093cb214551ce1929caae0681fdba282b3d8b4462adee7bb7 url: "https://pub.dev" source: hosted - version: "8.9.1" + version: "8.13.0" checked_yaml: dependency: transitive description: @@ -133,10 +133,10 @@ packages: dependency: "direct main" description: name: collection - sha256: ee67cb0715911d28db6bf4af1026078bd6f0128b07a5f66fb2ed94ec6783c09a + sha256: "2f5709ae4d3d59dd8f7cd309b4e023046b57d8a6c82130785d2b0e5868084e76" url: "https://pub.dev" source: hosted - version: "1.18.0" + version: "1.19.1" convert: dependency: transitive description: @@ -173,10 +173,10 @@ packages: dependency: transitive description: name: dart_style - sha256: "40ae61a5d43feea6d24bd22c0537a6629db858963b99b4bc1c3db80676f32368" + sha256: c87dfe3d56f183ffe9106a18aebc6db431fc7c98c31a54b952a77f3d54a85697 url: "https://pub.dev" source: hosted - version: "2.3.4" + version: "3.1.2" equatable: dependency: "direct main" description: @@ -205,18 +205,18 @@ packages: dependency: "direct dev" description: name: freezed - sha256: "57247f692f35f068cae297549a46a9a097100685c6780fe67177503eea5ed4e5" + sha256: "13065f10e135263a4f5a4391b79a8efc5fb8106f8dd555a9e49b750b45393d77" url: "https://pub.dev" source: hosted - version: "2.4.7" + version: "3.2.3" freezed_annotation: dependency: "direct dev" description: name: freezed_annotation - sha256: c3fd9336eb55a38cc1bbd79ab17573113a8deccd0ecbbf926cca3c62803b5c2d + sha256: "7294967ff0a6d98638e7acb774aac3af2550777accd8149c90af5b014e6d44d8" url: "https://pub.dev" source: hosted - version: "2.4.1" + version: "3.1.0" frontend_server_client: dependency: transitive description: @@ -309,18 +309,18 @@ packages: dependency: "direct main" description: name: json_annotation - sha256: b10a7b2ff83d83c777edba3c6a0f97045ddadd56c944e1a23a3fdf43a1bf4467 + sha256: "1ce844379ca14835a50d2f019a3099f419082cfdd231cd86a142af94dd5c6bb1" url: "https://pub.dev" source: hosted - version: "4.8.1" + version: "4.9.0" json_serializable: dependency: "direct dev" description: name: json_serializable - sha256: aa1f5a8912615733e0fdc7a02af03308933c93235bdc8d50d0b0c8a8ccb0b969 + sha256: c5b2ee75210a0f263c6c7b9eeea80553dbae96ea1bf57f02484e806a3ffdffa3 url: "https://pub.dev" source: hosted - version: "6.7.1" + version: "6.11.2" lints: dependency: "direct dev" description: @@ -349,10 +349,10 @@ packages: dependency: "direct main" description: name: meta - sha256: "7687075e408b093f36e6bbf6c91878cc0d4cd10f409506f7bc996f68220b9136" + sha256: "307249ce4ff29d58a18e97f6345f539382eb9c9c29ecda628900f31de0443dd9" url: "https://pub.dev" source: hosted - version: "1.12.0" + version: "1.19.0" mime: dependency: transitive description: @@ -365,10 +365,10 @@ packages: dependency: "direct dev" description: name: mockito - sha256: "6841eed20a7befac0ce07df8116c8b8233ed1f4486a7647c7fc5a02ae6163917" + sha256: eff30d002f0c8bf073b6f929df4483b543133fcafce056870163587b03f1d422 url: "https://pub.dev" source: hosted - version: "5.4.4" + version: "5.6.4" node_preamble: dependency: transitive description: @@ -405,10 +405,10 @@ packages: dependency: transitive description: name: pub_semver - sha256: "40d3ab1bbd474c4c2328c91e3a7df8c6dd629b79ece4c4bd04bee496a224fb0c" + sha256: "261236774e8b1d69cfc6b9eabbc96c40f25e7a2d6b171f3385d4f65d5734fb24" url: "https://pub.dev" source: hosted - version: "2.1.4" + version: "2.2.1" pubspec_parse: dependency: "direct main" description: @@ -477,26 +477,26 @@ packages: dependency: "direct main" description: name: source_gen - sha256: "14658ba5f669685cd3d63701d01b31ea748310f7ab854e471962670abcf57832" + sha256: "1d562a3c1f713904ebbed50d2760217fd8a51ca170ac4b05b0db490699dbac17" url: "https://pub.dev" source: hosted - version: "1.5.0" + version: "4.2.0" source_gen_test: dependency: "direct dev" description: name: source_gen_test - sha256: "0929da347d2dd868fed3a278b52ab4bf4467cff9a8cae40b6abbd6e96e5c4840" + sha256: ea04702ef212a71cf7dcf321cdd4af994aabafe8f09ab7c285aef2770a4449c9 url: "https://pub.dev" source: hosted - version: "1.0.6" + version: "1.3.2" source_helper: dependency: "direct main" description: name: source_helper - sha256: "6adebc0006c37dd63fe05bca0a929b99f06402fc95aa35bf36d67f5c06de01fd" + sha256: "6a3c6cc82073a8797f8c4dc4572146114a39652851c157db37e964d9c7038723" url: "https://pub.dev" source: hosted - version: "1.3.4" + version: "1.3.8" source_map_stack_trace: dependency: transitive description: @@ -581,26 +581,26 @@ packages: dependency: "direct dev" description: name: test - sha256: "7ee446762c2c50b3bd4ea96fe13ffac69919352bd3b4b17bac3f3465edc58073" + sha256: "75906bf273541b676716d1ca7627a17e4c4070a3a16272b7a3dc7da3b9f3f6b7" url: "https://pub.dev" source: hosted - version: "1.25.2" + version: "1.26.3" test_api: dependency: transitive description: name: test_api - sha256: "9955ae474176f7ac8ee4e989dadfb411a58c30415bcfb648fa04b2b8a03afa7f" + sha256: ab2726c1a94d3176a45960b6234466ec367179b87dd74f1611adb1f3b5fb9d55 url: "https://pub.dev" source: hosted - version: "0.7.0" + version: "0.7.7" test_core: dependency: transitive description: name: test_core - sha256: "2bc4b4ecddd75309300d8096f781c0e3280ca1ef85beda558d33fcbedc2eead4" + sha256: "0cc24b5ff94b38d2ae73e1eb43cc302b77964fbf67abad1e296025b78deb53d0" url: "https://pub.dev" source: hosted - version: "0.6.0" + version: "0.6.12" timing: dependency: transitive description: @@ -674,4 +674,4 @@ packages: source: hosted version: "3.1.2" sdks: - dart: ">=3.4.0 <4.0.0" + dart: ">=3.9.0 <4.0.0" diff --git a/pubspec.yaml b/pubspec.yaml index c6bb2cce..03b07d55 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -10,10 +10,9 @@ environment: sdk: '>=3.2.0 <4.0.0' dependencies: - analyzer: ^6.1.0 + analyzer: '>=6.1.0 <15.0.0' async: ^2.6.1 - build: ^2.0.2 - build_resolvers: ^2.0.10 + build: '>=2.0.2 <5.0.0' collection: ^1.16.0 crypto: ^3.0.1 equatable: ^2.0.2 @@ -28,18 +27,17 @@ dependencies: pubspec_parse: ^1.0.0 recase: ^4.0.0 retry: ^3.1.0 - riverpod: ^2.1.1 - source_gen: ^1.0.1 + riverpod: '>=2.1.1 <4.0.0' + source_gen: '>=1.0.1 <5.0.0' source_helper: ^1.3.2 state_notifier: ^1.0.0 uuid: ^4.2.1 dev_dependencies: - build_runner: ^2.3.0 - build_test: ^2.1.0 + build_runner: ^2.6.0 coverage: ^1.3.2 - freezed: ^2.3.0 - freezed_annotation: ^2.0.1 + freezed: ^3.0.0 + freezed_annotation: ^3.0.0 json_serializable: ^6.7.1 lints: ^3.0.0 matcher: ^0.12.10 From ed5b7300a2470dae23ecc9563f2049740c9e2e46 Mon Sep 17 00:00:00 2001 From: Joshua Mayanja Date: Tue, 15 Sep 2026 17:13:47 +0300 Subject: [PATCH 4/8] Trigger CI now that Actions is enabled on the fork From ae3604ef7f28ac1d4eb30381d4f8184b87487f65 Mon Sep 17 00:00:00 2001 From: Joshua Mayanja Date: Tue, 15 Sep 2026 17:14:33 +0300 Subject: [PATCH 5/8] Fix CI triggers to match this fork's actual branches MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The inherited workflow only fired on push/PR to master. Every commit here lives on 1.6.x/hive-ce instead (master diverged onto upstream's sqlite3 rewrite — see the PR #1 base-branch fix), so nothing has run since Actions was enabled on the fork. --- .github/workflows/test.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index d8c83886..858fcf59 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -2,9 +2,9 @@ name: test on: push: - branches: [master] + branches: [master, 1.6.x, hive-ce] pull_request: - branches: [master] + branches: [master, 1.6.x] jobs: build: From c15b96ffab0d7da093cff3c4b2c64bea3a0d86e7 Mon Sep 17 00:00:00 2001 From: Joshua Mayanja Date: Tue, 15 Sep 2026 17:15:39 +0300 Subject: [PATCH 6/8] Bump stale pinned Action versions blocking CI dart-lang/setup-dart@v1.5 no longer resolves (tag removed upstream); actions/checkout@v2 bumped alongside it while touching this file. --- .github/workflows/test.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 858fcf59..ea63bbd2 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -31,8 +31,8 @@ jobs: runs-on: ${{ matrix.os }} steps: - - uses: dart-lang/setup-dart@v1.5 - - uses: actions/checkout@v2 + - uses: dart-lang/setup-dart@v1.8.1 + - uses: actions/checkout@v4 - name: Install dependencies run: dart pub get - name: Run tests @@ -56,8 +56,8 @@ jobs: codegen: runs-on: ubuntu-latest steps: - - uses: dart-lang/setup-dart@v1.5 - - uses: actions/checkout@v2 + - uses: dart-lang/setup-dart@v1.8.1 + - uses: actions/checkout@v4 - name: Install dependencies (root) run: dart pub get - name: Install dependencies (example) From 189b87a3cc06db2c263d93b49de0cba6d0292889 Mon Sep 17 00:00:00 2001 From: Joshua Mayanja Date: Tue, 15 Sep 2026 17:21:42 +0300 Subject: [PATCH 7/8] Override frontend_server_client to fix dart test entirely MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This is what was actually breaking build_runner/dart test everywhere so far — including on GitHub's own hosted runner, not just locally. frontend_server_client 3.2.0 (what everything here resolves to unforced) can't find frontend_server.dart.snapshot under current Dart SDKs; the fix ships in frontend_server_client 4.0.0, which every transitive constraint already permits, nothing was pinning it low on purpose. See https://github.com/dart-lang/sdk/issues/60198, closed by the reporter's own frontend_server_client upgrade. All 157 tests pass locally now (4s). This is a dependency_override, so it only fixes resolution when this repo itself is the root package — running its own test/codegen CI. It does not propagate to consuming apps automatically; an app hitting the same missing-snapshot error needs the same override in its own pubspec. --- pubspec.lock | 6 +++--- pubspec.yaml | 10 ++++++++++ 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/pubspec.lock b/pubspec.lock index 67d8366a..c1a678c9 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -218,13 +218,13 @@ packages: source: hosted version: "3.1.0" frontend_server_client: - dependency: transitive + dependency: "direct overridden" description: name: frontend_server_client - sha256: "408e3ca148b31c20282ad6f37ebfa6f4bdc8fede5b74bc2f08d9d92b55db3612" + sha256: f64a0333a82f30b0cca061bc3d143813a486dc086b574bfb233b7c1372427694 url: "https://pub.dev" source: hosted - version: "3.2.0" + version: "4.0.0" glob: dependency: "direct main" description: diff --git a/pubspec.yaml b/pubspec.yaml index 03b07d55..a2c43709 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -44,3 +44,13 @@ dev_dependencies: mockito: ^5.0.9 source_gen_test: ^1.0.0 test: ^1.22.0 + +# frontend_server_client 3.2.0 (what every consumer here resolves to +# unforced) can't find frontend_server.dart.snapshot under current Dart +# SDKs — the file's location changed and 3.2.0 predates that. The fix +# lives entirely in frontend_server_client's own 4.0.0 release, not in +# anything this package controls; the transitive constraints from test/ +# build_runner already allow 4.x, nothing was pinning it low on purpose. +# See https://github.com/dart-lang/sdk/issues/60198. +dependency_overrides: + frontend_server_client: ^4.0.0 From 3b28e231d29beabd858496f929816adc4b75f6a2 Mon Sep 17 00:00:00 2001 From: Joshua Mayanja Date: Tue, 15 Sep 2026 17:24:18 +0300 Subject: [PATCH 8/8] Fix real null-promotion regression surfaced by CI on Dart 3.13.4 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Two call sites used bare \`remote\` (after \`remote ??= _remote\`) relying on flow-typing to promote it from bool? to bool — the same pattern this file already guards with \`!\` everywhere else it uses \`remote\`. Dart 3.12.2 (this sandbox) still promotes it here; Dart 3.13.4 (GitHub's runner, current stable) does not, and fails to compile without the explicit assertion. Matched the existing pattern instead of relying on promotion either way. Locally this shows as a harmless "unnecessary '!'" warning, not an error — expected, since 3.12.2 still promotes; 3.13.4 is authoritative here as the actual current stable SDK. --- lib/src/repository/remote_adapter_watch.dart | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/src/repository/remote_adapter_watch.dart b/lib/src/repository/remote_adapter_watch.dart index 148651df..83ce82c9 100644 --- a/lib/src/repository/remote_adapter_watch.dart +++ b/lib/src/repository/remote_adapter_watch.dart @@ -60,7 +60,7 @@ mixin _RemoteAdapterWatch> on _RemoteAdapter { return []; }, ); - if (remote) { + if (remote!) { // trigger doneLoading to ensure state is updated with isLoading=false graph._notify([label.toString()], type: DataGraphEventType.doneLoading); } @@ -206,7 +206,7 @@ mixin _RemoteAdapterWatch> on _RemoteAdapter { ); // trigger doneLoading to ensure state is updated with isLoading=false final modelKey = model?._key; - if (remote && modelKey != null) { + if (remote! && modelKey != null) { graph._notify([modelKey, label.toString()], type: DataGraphEventType.doneLoading); }