From fbd0b3fa2b2ae02e4c5447c63e5045cba8a3228f Mon Sep 17 00:00:00 2001 From: Martin Kamleithner Date: Fri, 10 Nov 2023 23:31:31 +0000 Subject: [PATCH] feat(ferry_cache): use varsToJson instead of casting to dynamic --- packages/ferry_cache/lib/src/cache.dart | 12 ++++-------- .../lib/src/fragment_data_change_stream.dart | 3 +-- .../lib/src/operation_data_change_stream.dart | 3 +-- packages/ferry_cache/pubspec.yaml | 2 +- 4 files changed, 7 insertions(+), 13 deletions(-) diff --git a/packages/ferry_cache/lib/src/cache.dart b/packages/ferry_cache/lib/src/cache.dart index d1203f4a..bd89e5d6 100644 --- a/packages/ferry_cache/lib/src/cache.dart +++ b/packages/ferry_cache/lib/src/cache.dart @@ -127,8 +127,7 @@ class Cache { document: request.operation.document, addTypename: addTypename, operationName: request.operation.operationName, - // TODO: don't cast to dynamic - variables: (request.vars as dynamic)?.toJson(), + variables: request.varsToJson, typePolicies: typePolicies, dataIdFromObject: dataIdFromObject, possibleTypes: possibleTypes, @@ -147,8 +146,7 @@ class Cache { document: request.document, idFields: request.idFields, fragmentName: request.fragmentName, - // TODO: don't cast to dynamic - variables: (request.vars as dynamic)?.toJson(), + variables: request.varsToJson, typePolicies: typePolicies, addTypename: addTypename, dataIdFromObject: dataIdFromObject, @@ -179,8 +177,7 @@ class Cache { ), document: request.operation.document, operationName: request.operation.operationName, - // TODO: don't cast to dynamic - variables: (request.vars as dynamic)?.toJson(), + variables: request.varsToJson, data: (data as dynamic)?.toJson(), typePolicies: typePolicies, addTypename: addTypename, @@ -212,8 +209,7 @@ class Cache { document: request.document, idFields: request.idFields, fragmentName: request.fragmentName, - // TODO: don't cast to dynamic - variables: (request.vars as dynamic)?.toJson(), + variables: request.varsToJson, data: (data as dynamic)?.toJson(), typePolicies: typePolicies, addTypename: addTypename, diff --git a/packages/ferry_cache/lib/src/fragment_data_change_stream.dart b/packages/ferry_cache/lib/src/fragment_data_change_stream.dart index e78d584f..996928d3 100644 --- a/packages/ferry_cache/lib/src/fragment_data_change_stream.dart +++ b/packages/ferry_cache/lib/src/fragment_data_change_stream.dart @@ -36,8 +36,7 @@ Stream> fragmentDataChangeStream( idFields: request.idFields, fragmentName: request.fragmentName, document: request.document, - // TODO: don't cast to dynamic - variables: (request.vars as dynamic)?.toJson(), + variables: request.varsToJson, typePolicies: typePolicies, addTypename: addTypename, returnPartialData: true, diff --git a/packages/ferry_cache/lib/src/operation_data_change_stream.dart b/packages/ferry_cache/lib/src/operation_data_change_stream.dart index 4c5635e2..42c90e1c 100644 --- a/packages/ferry_cache/lib/src/operation_data_change_stream.dart +++ b/packages/ferry_cache/lib/src/operation_data_change_stream.dart @@ -45,8 +45,7 @@ Stream> operationDataChangeStream( }, document: request.operation.document, operationName: request.operation.operationName, - // TODO: don't cast to dynamic - variables: (request.vars as dynamic)?.toJson(), + variables: request.varsToJson, typePolicies: typePolicies, addTypename: addTypename, returnPartialData: true, diff --git a/packages/ferry_cache/pubspec.yaml b/packages/ferry_cache/pubspec.yaml index 865109f1..2074d7fb 100644 --- a/packages/ferry_cache/pubspec.yaml +++ b/packages/ferry_cache/pubspec.yaml @@ -4,7 +4,7 @@ homepage: https://ferrygraphql.com/ description: A normalized, strongly typed, optimistic cache for GraphQL Operations and Fragments repository: https://github.com/gql-dart/ferry environment: - sdk: '>=2.12.0 <3.0.0' + sdk: '>=3.0.0 <4.0.0' dependencies: ferry_exec: ^0.4.0 meta: ^1.3.0