diff --git a/ferry_cache/lib/src/cache.dart b/ferry_cache/lib/src/cache.dart index 6ce4a081..576f38a9 100644 --- a/ferry_cache/lib/src/cache.dart +++ b/ferry_cache/lib/src/cache.dart @@ -25,14 +25,13 @@ class Cache { Cache({ Store? store, - utils.DataIdResolver? dataIdFromObject, + this.dataIdFromObject, this.typePolicies = const {}, this.addTypename = true, Map?>> seedOptimisticPatches = const {}, }) : store = store ?? MemoryStore(), - optimisticPatchesStream = BehaviorSubject.seeded(seedOptimisticPatches), - dataIdFromObject = dataIdFromObject; + optimisticPatchesStream = BehaviorSubject.seeded(seedOptimisticPatches); /// Reads data for the given [dataId] from the [Store], merging in any data from optimistic patches @visibleForTesting @@ -65,7 +64,7 @@ class Cache { store, typePolicies, addTypename, - dataIdFromObject: dataIdFromObject, + dataIdFromObject, ).doOnDone(() => closed = true); return NeverStream() @@ -101,7 +100,7 @@ class Cache { store, typePolicies, addTypename, - dataIdFromObject: dataIdFromObject, + dataIdFromObject, ).doOnDone(() => closed = true); return NeverStream() diff --git a/ferry_cache/lib/src/fragment_data_change_stream.dart b/ferry_cache/lib/src/fragment_data_change_stream.dart index d3427511..07bcfa67 100644 --- a/ferry_cache/lib/src/fragment_data_change_stream.dart +++ b/ferry_cache/lib/src/fragment_data_change_stream.dart @@ -10,15 +10,16 @@ import './utils/data_for_id_stream.dart'; /// Emits when the data for this fragment changes, returning a `Set` of changed IDs. Stream> fragmentDataChangeStream( - FragmentRequest request, - bool optimistic, - Stream?>>?> - optimisticPatchesStream, - Map? Function(String dataId) optimisticReader, - Store store, - Map typePolicies, - bool addTypename, - {DataIdResolver? dataIdFromObject}) { + FragmentRequest request, + bool optimistic, + Stream?>>?> + optimisticPatchesStream, + Map? Function(String dataId) optimisticReader, + Store store, + Map typePolicies, + bool addTypename, + DataIdResolver? dataIdFromObject, +) { final dataIds = {}; denormalizeFragment( diff --git a/ferry_cache/lib/src/operation_data_change_stream.dart b/ferry_cache/lib/src/operation_data_change_stream.dart index b7f34dbc..b0decb4b 100644 --- a/ferry_cache/lib/src/operation_data_change_stream.dart +++ b/ferry_cache/lib/src/operation_data_change_stream.dart @@ -11,15 +11,16 @@ import './utils/operation_root_data.dart'; /// Emits when the data for this request changes, returning a `Set` of changed IDs. Stream> operationDataChangeStream( - OperationRequest request, - bool optimistic, - Stream?>>?> - optimisticPatchesStream, - Map? Function(String dataId) optimisticReader, - Store store, - Map typePolicies, - bool addTypename, - {DataIdResolver? dataIdFromObject}) { + OperationRequest request, + bool optimistic, + Stream?>>?> + optimisticPatchesStream, + Map? Function(String dataId) optimisticReader, + Store store, + Map typePolicies, + bool addTypename, + DataIdResolver? dataIdFromObject, +) { final operationDefinition = getOperationDefinition( request.operation.document, request.operation.operationName, diff --git a/ferry_cache/test/data_change_streams_test.dart b/ferry_cache/test/data_change_streams_test.dart index 4fba375a..520601b2 100644 --- a/ferry_cache/test/data_change_streams_test.dart +++ b/ferry_cache/test/data_change_streams_test.dart @@ -65,6 +65,7 @@ void main() { cache.store, {}, true, + null, ); expect( @@ -87,6 +88,7 @@ void main() { cache.store, {}, true, + null, ); expect(stream, emitsInOrder([emitsDone])); @@ -110,6 +112,7 @@ void main() { cache.store, {}, true, + null, ); expect(stream, emitsInOrder([emitsDone])); @@ -130,6 +133,7 @@ void main() { cache.store, {}, true, + null, ); expect(stream, emitsInOrder([emitsDone])); @@ -153,6 +157,7 @@ void main() { cache.store, {}, true, + null, ); expect( @@ -184,6 +189,7 @@ void main() { cache.store, {}, true, + null, ); expect( @@ -218,6 +224,7 @@ void main() { cache.store, {}, true, + null, ); expect(stream, emitsInOrder([emitsDone])); @@ -247,6 +254,7 @@ void main() { cache.store, {}, true, + null, ); expect( @@ -282,6 +290,7 @@ void main() { cache.store, {}, true, + null, ); expect( @@ -318,6 +327,7 @@ void main() { cache.store, {}, true, + null, ); expect( @@ -338,6 +348,7 @@ void main() { cache.store, {}, true, + null, ); expect(stream, emitsInOrder([emitsDone])); @@ -358,6 +369,7 @@ void main() { cache.store, {}, true, + null, ); expect( @@ -388,6 +400,7 @@ void main() { cache.store, {}, true, + null, ); expect(