diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS new file mode 100644 index 00000000..8d8b351b --- /dev/null +++ b/.github/CODEOWNERS @@ -0,0 +1,3 @@ +# The following team is the owner for everything in the repo. Everyone in +# the team will be requested for review when someone opens a pull request. +* @wildfork/us-mobile-app diff --git a/example/pubspec.lock b/example/pubspec.lock index 170e77aa..8ffef529 100644 --- a/example/pubspec.lock +++ b/example/pubspec.lock @@ -91,7 +91,7 @@ packages: name: collection url: "https://pub.dartlang.org" source: hosted - version: "1.15.0" + version: "1.16.0" convert: dependency: transitive description: @@ -119,7 +119,7 @@ packages: name: fake_async url: "https://pub.dartlang.org" source: hosted - version: "1.2.0" + version: "1.3.0" ffi: dependency: transitive description: @@ -145,7 +145,7 @@ packages: path: ".." relative: true source: path - version: "0.0.25-alpha" + version: "0.0.26-alpha" flutter_test: dependency: "direct dev" description: flutter @@ -260,7 +260,7 @@ packages: name: js url: "https://pub.dartlang.org" source: hosted - version: "0.6.3" + version: "0.6.4" json_annotation: dependency: transitive description: @@ -295,7 +295,7 @@ packages: name: material_color_utilities url: "https://pub.dartlang.org" source: hosted - version: "0.1.3" + version: "0.1.4" meta: dependency: transitive description: @@ -323,7 +323,7 @@ packages: name: path url: "https://pub.dartlang.org" source: hosted - version: "1.8.0" + version: "1.8.1" path_provider_linux: dependency: transitive description: @@ -468,7 +468,7 @@ packages: name: source_span url: "https://pub.dartlang.org" source: hosted - version: "1.8.1" + version: "1.8.2" stack_trace: dependency: transitive description: @@ -503,7 +503,7 @@ packages: name: test_api url: "https://pub.dartlang.org" source: hosted - version: "0.4.8" + version: "0.4.9" typed_data: dependency: transitive description: @@ -580,7 +580,7 @@ packages: name: vector_math url: "https://pub.dartlang.org" source: hosted - version: "2.1.1" + version: "2.1.2" watcher: dependency: transitive description: @@ -617,5 +617,5 @@ packages: source: hosted version: "3.1.0" sdks: - dart: ">=2.15.0 <3.0.0" - flutter: ">=2.10.1" + dart: ">=2.17.0-0 <3.0.0" + flutter: ">=2.10.0" diff --git a/lib/graphql_operations/mutations/customer_create.dart b/lib/graphql_operations/mutations/customer_create.dart index 823fd7f4..c0b142fa 100644 --- a/lib/graphql_operations/mutations/customer_create.dart +++ b/lib/graphql_operations/mutations/customer_create.dart @@ -48,6 +48,7 @@ mutation MyMutation($firstName: String, $lastName: String, $email: String!, $pas displayName email firstName + lastName id lastIncompleteCheckout { completedAt diff --git a/lib/graphql_operations/queries/get_all_products_from_collection_by_id.dart b/lib/graphql_operations/queries/get_all_products_from_collection_by_id.dart index 935e00b5..9ad5e449 100644 --- a/lib/graphql_operations/queries/get_all_products_from_collection_by_id.dart +++ b/lib/graphql_operations/queries/get_all_products_from_collection_by_id.dart @@ -83,7 +83,6 @@ query($id : ID!, $cursor : String, $sortKey: ProductCollectionSortKeys){ } availableForSale id - quantityAvailable unitPrice { amount currencyCode diff --git a/lib/graphql_operations/queries/get_all_products_on_query.dart b/lib/graphql_operations/queries/get_all_products_on_query.dart index c7ffdf2c..998ed35c 100644 --- a/lib/graphql_operations/queries/get_all_products_on_query.dart +++ b/lib/graphql_operations/queries/get_all_products_on_query.dart @@ -57,7 +57,6 @@ query( $cursor: String, $sortKey : ProductSortKeys, $query: String, $reverse: Bo value } id - quantityAvailable } } } diff --git a/lib/graphql_operations/queries/get_collections.dart b/lib/graphql_operations/queries/get_collections.dart index 589cddca..45acf3e4 100644 --- a/lib/graphql_operations/queries/get_collections.dart +++ b/lib/graphql_operations/queries/get_collections.dart @@ -47,7 +47,6 @@ query($cursor: String, $sortKey: CollectionSortKeys, $reverse: Boolean){ value } availableForSale - quantityAvailable } } } diff --git a/lib/graphql_operations/queries/get_customer.dart b/lib/graphql_operations/queries/get_customer.dart index 46ba3faf..6035f6b1 100644 --- a/lib/graphql_operations/queries/get_customer.dart +++ b/lib/graphql_operations/queries/get_customer.dart @@ -49,6 +49,16 @@ query($customerAccessToken : String!){ firstName id lastName + metafields(first:250) { + edges { + node { + id + key + namespace + value + } + } + } lastIncompleteCheckout { completedAt createdAt diff --git a/lib/graphql_operations/queries/get_featured_collections.dart b/lib/graphql_operations/queries/get_featured_collections.dart index 85e5ab4e..322bf5f2 100644 --- a/lib/graphql_operations/queries/get_featured_collections.dart +++ b/lib/graphql_operations/queries/get_featured_collections.dart @@ -39,7 +39,6 @@ query getFeaturedCollectionQuery($query: String!){ sku requiresShipping availableForSale - quantityAvailable selectedOptions { name value diff --git a/lib/graphql_operations/queries/get_meta_field.dart b/lib/graphql_operations/queries/get_meta_field.dart new file mode 100644 index 00000000..ffa4f3f9 --- /dev/null +++ b/lib/graphql_operations/queries/get_meta_field.dart @@ -0,0 +1,18 @@ +const String getMetaField = r''' +query ProductMetafields($productId : ID!){ + product(id: $productId) { + metafields(namespace: "wildfox", first: 50) { + edges { + node { + id + namespace + key + value + valueType + description + } + } + } + } +} +'''; diff --git a/lib/graphql_operations/queries/get_n_products.dart b/lib/graphql_operations/queries/get_n_products.dart index eff74cf3..ac066aff 100644 --- a/lib/graphql_operations/queries/get_n_products.dart +++ b/lib/graphql_operations/queries/get_n_products.dart @@ -35,7 +35,6 @@ query($n : Int, $sortKey : ProductSortKeys, $reverse: Boolean){ availableForSale sku requiresShipping - quantityAvailable selectedOptions { name value diff --git a/lib/graphql_operations/queries/get_product_recommendations.dart b/lib/graphql_operations/queries/get_product_recommendations.dart index 711f1cc2..7820d037 100644 --- a/lib/graphql_operations/queries/get_product_recommendations.dart +++ b/lib/graphql_operations/queries/get_product_recommendations.dart @@ -51,7 +51,6 @@ query getProductRecommentationsQuery($id: ID!){ availableForSale sku requiresShipping - quantityAvailable selectedOptions { name value diff --git a/lib/graphql_operations/queries/get_products.dart b/lib/graphql_operations/queries/get_products.dart index cdbe90b6..32934a92 100644 --- a/lib/graphql_operations/queries/get_products.dart +++ b/lib/graphql_operations/queries/get_products.dart @@ -47,7 +47,6 @@ query($cursor : String, $metafieldsNamespace : String){ availableForSale sku requiresShipping - quantityAvailable selectedOptions { name value diff --git a/lib/graphql_operations/queries/get_products_by_handle.dart b/lib/graphql_operations/queries/get_products_by_handle.dart index 920461fe..c7d90f74 100644 --- a/lib/graphql_operations/queries/get_products_by_handle.dart +++ b/lib/graphql_operations/queries/get_products_by_handle.dart @@ -17,10 +17,9 @@ query getProductByHandle($handle : String!){ amount currencyCode } - quantityAvailable } } } } } -'''; \ No newline at end of file +'''; diff --git a/lib/graphql_operations/queries/get_products_by_ids.dart b/lib/graphql_operations/queries/get_products_by_ids.dart index 8a014ea1..c753aeba 100644 --- a/lib/graphql_operations/queries/get_products_by_ids.dart +++ b/lib/graphql_operations/queries/get_products_by_ids.dart @@ -62,7 +62,6 @@ query($ids : [ID!]!){ value } id - quantityAvailable } } } diff --git a/lib/graphql_operations/queries/get_x_collections_and_n_products_sorted.dart b/lib/graphql_operations/queries/get_x_collections_and_n_products_sorted.dart index 61fbd2e4..8c87869e 100644 --- a/lib/graphql_operations/queries/get_x_collections_and_n_products_sorted.dart +++ b/lib/graphql_operations/queries/get_x_collections_and_n_products_sorted.dart @@ -47,7 +47,6 @@ query($cursor: String, $sortKey: CollectionSortKeys, $sortKeyProduct: ProductCol value } availableForSale - quantityAvailable } } } diff --git a/lib/graphql_operations/queries/get_x_products_after_cursor.dart b/lib/graphql_operations/queries/get_x_products_after_cursor.dart index 53fc80eb..d5eff096 100644 --- a/lib/graphql_operations/queries/get_x_products_after_cursor.dart +++ b/lib/graphql_operations/queries/get_x_products_after_cursor.dart @@ -35,7 +35,6 @@ query($cursor : String, $x : Int, $reverse: Boolean, $sortKey: ProductSortKeys){ availableForSale sku requiresShipping - quantityAvailable selectedOptions { name value diff --git a/lib/graphql_operations/queries/get_x_products_after_cursor_within_collection.dart b/lib/graphql_operations/queries/get_x_products_after_cursor_within_collection.dart index d2cc95ff..eb584969 100644 --- a/lib/graphql_operations/queries/get_x_products_after_cursor_within_collection.dart +++ b/lib/graphql_operations/queries/get_x_products_after_cursor_within_collection.dart @@ -83,7 +83,6 @@ query($id : ID!, $cursor : String, $limit : Int, $sortKey : ProductCollectionSor } availableForSale id - quantityAvailable } } } diff --git a/lib/graphql_operations/queries/get_x_products_on_query_after_cursor.dart b/lib/graphql_operations/queries/get_x_products_on_query_after_cursor.dart index 1e630814..a7ddcc5d 100644 --- a/lib/graphql_operations/queries/get_x_products_on_query_after_cursor.dart +++ b/lib/graphql_operations/queries/get_x_products_on_query_after_cursor.dart @@ -57,7 +57,6 @@ query( $cursor: String, $limit : Int, $sortKey : ProductSortKeys, $query: String value } id - quantityAvailable } } } diff --git a/lib/models/src/product/metafield/metafield.dart b/lib/models/src/product/metafield/metafield.dart index d924b1ef..bdd99d3f 100644 --- a/lib/models/src/product/metafield/metafield.dart +++ b/lib/models/src/product/metafield/metafield.dart @@ -13,7 +13,7 @@ class Metafield with _$Metafield { required String key, required String value, required String valueType, - @Default('') String description, + @Default('') String? description, }) = _Metafield; static Metafield fromGraphJson(Map json) { diff --git a/lib/models/src/product/metafield/metafield.freezed.dart b/lib/models/src/product/metafield/metafield.freezed.dart index cffd8cd2..2f15afa7 100644 --- a/lib/models/src/product/metafield/metafield.freezed.dart +++ b/lib/models/src/product/metafield/metafield.freezed.dart @@ -28,7 +28,7 @@ class _$MetafieldTearOff { required String key, required String value, required String valueType, - String description = ''}) { + String? description = ''}) { return _Metafield( id: id, namespace: namespace, @@ -54,7 +54,7 @@ mixin _$Metafield { String get key => throw _privateConstructorUsedError; String get value => throw _privateConstructorUsedError; String get valueType => throw _privateConstructorUsedError; - String get description => throw _privateConstructorUsedError; + String? get description => throw _privateConstructorUsedError; Map toJson() => throw _privateConstructorUsedError; @JsonKey(ignore: true) @@ -72,7 +72,7 @@ abstract class $MetafieldCopyWith<$Res> { String key, String value, String valueType, - String description}); + String? description}); } /// @nodoc @@ -116,7 +116,7 @@ class _$MetafieldCopyWithImpl<$Res> implements $MetafieldCopyWith<$Res> { description: description == freezed ? _value.description : description // ignore: cast_nullable_to_non_nullable - as String, + as String?, )); } } @@ -133,7 +133,7 @@ abstract class _$MetafieldCopyWith<$Res> implements $MetafieldCopyWith<$Res> { String key, String value, String valueType, - String description}); + String? description}); } /// @nodoc @@ -178,7 +178,7 @@ class __$MetafieldCopyWithImpl<$Res> extends _$MetafieldCopyWithImpl<$Res> description: description == freezed ? _value.description : description // ignore: cast_nullable_to_non_nullable - as String, + as String?, )); } } @@ -210,7 +210,7 @@ class _$_Metafield extends _Metafield { final String valueType; @JsonKey() @override - final String description; + final String? description; @override String toString() { @@ -259,7 +259,7 @@ abstract class _Metafield extends Metafield { required String key, required String value, required String valueType, - String description}) = _$_Metafield; + String? description}) = _$_Metafield; _Metafield._() : super._(); factory _Metafield.fromJson(Map json) = @@ -276,7 +276,7 @@ abstract class _Metafield extends Metafield { @override String get valueType; @override - String get description; + String? get description; @override @JsonKey(ignore: true) _$MetafieldCopyWith<_Metafield> get copyWith => diff --git a/lib/models/src/product/product_variant/product_variant.dart b/lib/models/src/product/product_variant/product_variant.dart index 10cb6414..fa0e9ca8 100644 --- a/lib/models/src/product/product_variant/product_variant.dart +++ b/lib/models/src/product/product_variant/product_variant.dart @@ -19,7 +19,6 @@ class ProductVariant with _$ProductVariant { required String sku, required bool requiresShipping, required String id, - required int quantityAvailable, PriceV2? unitPrice, UnitPriceMeasurement? unitPriceMeasurement, List? selectedOptions, @@ -45,7 +44,6 @@ class ProductVariant with _$ProductVariant { sku: nodeJson['sku'], requiresShipping: nodeJson['requiresShipping'], id: nodeJson['id'], - quantityAvailable: nodeJson['quantityAvailable'], unitPrice: nodeJson['unitPrice'] != null ? PriceV2.fromJson(nodeJson['unitPrice']) : null, diff --git a/lib/models/src/product/product_variant/product_variant.freezed.dart b/lib/models/src/product/product_variant/product_variant.freezed.dart index fd063b44..60611fb8 100644 --- a/lib/models/src/product/product_variant/product_variant.freezed.dart +++ b/lib/models/src/product/product_variant/product_variant.freezed.dart @@ -31,7 +31,6 @@ class _$ProductVariantTearOff { required String sku, required bool requiresShipping, required String id, - required int quantityAvailable, PriceV2? unitPrice, UnitPriceMeasurement? unitPriceMeasurement, List? selectedOptions, @@ -46,7 +45,6 @@ class _$ProductVariantTearOff { sku: sku, requiresShipping: requiresShipping, id: id, - quantityAvailable: quantityAvailable, unitPrice: unitPrice, unitPriceMeasurement: unitPriceMeasurement, selectedOptions: selectedOptions, @@ -73,7 +71,6 @@ mixin _$ProductVariant { String get sku => throw _privateConstructorUsedError; bool get requiresShipping => throw _privateConstructorUsedError; String get id => throw _privateConstructorUsedError; - int get quantityAvailable => throw _privateConstructorUsedError; PriceV2? get unitPrice => throw _privateConstructorUsedError; UnitPriceMeasurement? get unitPriceMeasurement => throw _privateConstructorUsedError; @@ -102,7 +99,6 @@ abstract class $ProductVariantCopyWith<$Res> { String sku, bool requiresShipping, String id, - int quantityAvailable, PriceV2? unitPrice, UnitPriceMeasurement? unitPriceMeasurement, List? selectedOptions, @@ -135,7 +131,6 @@ class _$ProductVariantCopyWithImpl<$Res> Object? sku = freezed, Object? requiresShipping = freezed, Object? id = freezed, - Object? quantityAvailable = freezed, Object? unitPrice = freezed, Object? unitPriceMeasurement = freezed, Object? selectedOptions = freezed, @@ -175,10 +170,6 @@ class _$ProductVariantCopyWithImpl<$Res> ? _value.id : id // ignore: cast_nullable_to_non_nullable as String, - quantityAvailable: quantityAvailable == freezed - ? _value.quantityAvailable - : quantityAvailable // ignore: cast_nullable_to_non_nullable - as int, unitPrice: unitPrice == freezed ? _value.unitPrice : unitPrice // ignore: cast_nullable_to_non_nullable @@ -271,7 +262,6 @@ abstract class _$ProductVariantCopyWith<$Res> String sku, bool requiresShipping, String id, - int quantityAvailable, PriceV2? unitPrice, UnitPriceMeasurement? unitPriceMeasurement, List? selectedOptions, @@ -311,7 +301,6 @@ class __$ProductVariantCopyWithImpl<$Res> Object? sku = freezed, Object? requiresShipping = freezed, Object? id = freezed, - Object? quantityAvailable = freezed, Object? unitPrice = freezed, Object? unitPriceMeasurement = freezed, Object? selectedOptions = freezed, @@ -351,10 +340,6 @@ class __$ProductVariantCopyWithImpl<$Res> ? _value.id : id // ignore: cast_nullable_to_non_nullable as String, - quantityAvailable: quantityAvailable == freezed - ? _value.quantityAvailable - : quantityAvailable // ignore: cast_nullable_to_non_nullable - as int, unitPrice: unitPrice == freezed ? _value.unitPrice : unitPrice // ignore: cast_nullable_to_non_nullable @@ -391,7 +376,6 @@ class _$_ProductVariant extends _ProductVariant { required this.sku, required this.requiresShipping, required this.id, - required this.quantityAvailable, this.unitPrice, this.unitPriceMeasurement, this.selectedOptions, @@ -419,8 +403,6 @@ class _$_ProductVariant extends _ProductVariant { @override final String id; @override - final int quantityAvailable; - @override final PriceV2? unitPrice; @override final UnitPriceMeasurement? unitPriceMeasurement; @@ -433,7 +415,7 @@ class _$_ProductVariant extends _ProductVariant { @override String toString() { - return 'ProductVariant(price: $price, title: $title, weight: $weight, weightUnit: $weightUnit, availableForSale: $availableForSale, sku: $sku, requiresShipping: $requiresShipping, id: $id, quantityAvailable: $quantityAvailable, unitPrice: $unitPrice, unitPriceMeasurement: $unitPriceMeasurement, selectedOptions: $selectedOptions, compareAtPrice: $compareAtPrice, image: $image)'; + return 'ProductVariant(price: $price, title: $title, weight: $weight, weightUnit: $weightUnit, availableForSale: $availableForSale, sku: $sku, requiresShipping: $requiresShipping, id: $id, unitPrice: $unitPrice, unitPriceMeasurement: $unitPriceMeasurement, selectedOptions: $selectedOptions, compareAtPrice: $compareAtPrice, image: $image)'; } @override @@ -452,8 +434,6 @@ class _$_ProductVariant extends _ProductVariant { const DeepCollectionEquality() .equals(other.requiresShipping, requiresShipping) && const DeepCollectionEquality().equals(other.id, id) && - const DeepCollectionEquality() - .equals(other.quantityAvailable, quantityAvailable) && const DeepCollectionEquality().equals(other.unitPrice, unitPrice) && const DeepCollectionEquality() .equals(other.unitPriceMeasurement, unitPriceMeasurement) && @@ -475,7 +455,6 @@ class _$_ProductVariant extends _ProductVariant { const DeepCollectionEquality().hash(sku), const DeepCollectionEquality().hash(requiresShipping), const DeepCollectionEquality().hash(id), - const DeepCollectionEquality().hash(quantityAvailable), const DeepCollectionEquality().hash(unitPrice), const DeepCollectionEquality().hash(unitPriceMeasurement), const DeepCollectionEquality().hash(selectedOptions), @@ -503,7 +482,6 @@ abstract class _ProductVariant extends ProductVariant { required String sku, required bool requiresShipping, required String id, - required int quantityAvailable, PriceV2? unitPrice, UnitPriceMeasurement? unitPriceMeasurement, List? selectedOptions, @@ -531,8 +509,6 @@ abstract class _ProductVariant extends ProductVariant { @override String get id; @override - int get quantityAvailable; - @override PriceV2? get unitPrice; @override UnitPriceMeasurement? get unitPriceMeasurement; diff --git a/lib/models/src/product/product_variant/product_variant.g.dart b/lib/models/src/product/product_variant/product_variant.g.dart index a1de48ae..1c3f512d 100644 --- a/lib/models/src/product/product_variant/product_variant.g.dart +++ b/lib/models/src/product/product_variant/product_variant.g.dart @@ -16,7 +16,6 @@ _$_ProductVariant _$$_ProductVariantFromJson(Map json) => sku: json['sku'] as String, requiresShipping: json['requiresShipping'] as bool, id: json['id'] as String, - quantityAvailable: json['quantityAvailable'] as int, unitPrice: json['unitPrice'] == null ? null : PriceV2.fromJson(json['unitPrice'] as Map), @@ -45,7 +44,6 @@ Map _$$_ProductVariantToJson(_$_ProductVariant instance) => 'sku': instance.sku, 'requiresShipping': instance.requiresShipping, 'id': instance.id, - 'quantityAvailable': instance.quantityAvailable, 'unitPrice': instance.unitPrice, 'unitPriceMeasurement': instance.unitPriceMeasurement, 'selectedOptions': instance.selectedOptions, diff --git a/lib/shopify/src/shopify_customer.dart b/lib/shopify/src/shopify_customer.dart index 1e5f13ba..29394fc7 100644 --- a/lib/shopify/src/shopify_customer.dart +++ b/lib/shopify/src/shopify_customer.dart @@ -2,10 +2,13 @@ import 'package:flutter_simple_shopify/graphql_operations/mutations/customer_add import 'package:flutter_simple_shopify/graphql_operations/mutations/customer_address_delete.dart'; import 'package:flutter_simple_shopify/graphql_operations/mutations/customer_address_update.dart'; import 'package:flutter_simple_shopify/graphql_operations/mutations/customer_update.dart'; +import 'package:flutter_simple_shopify/graphql_operations/queries/get_customer.dart'; import 'package:flutter_simple_shopify/mixins/src/shopfiy_error.dart'; +import 'package:flutter_simple_shopify/models/src/product/metafield/metafield.dart'; import 'package:flutter_simple_shopify/models/src/shopify_user/address/address.dart'; import 'package:graphql/client.dart'; +import '../../models/src/shopify_user/shopify_user.dart'; import '../../shopify_config.dart'; /// ShopifyCustomer class provides various methods for working with a user/customer. @@ -92,7 +95,22 @@ class ShopifyCustomer with ShopifyError { _graphQLClient!.cache.writeQuery(_options.asRequest, data: {}); } } + Future getCustomerMetaFields(String? customerAccessToken) async{ + // call query to get customer metafields + /*final MutationOptions _options = MutationOptions( + document: gql(getCustomerQuery), + variables: { + 'customerAccessToken': customerAccessToken, + //'id': addressId + });*/ + final WatchQueryOptions _getCustomer = WatchQueryOptions( + document: gql(getCustomerQuery), + variables: {'customerAccessToken': await customerAccessToken}); + final QueryResult result = (await _graphQLClient!.query(_getCustomer)); + checkForError(result); + return result.data!['customer']['tags']; + } /// Creates a address for the customer to which [customerAccessToken] belongs to. Future
customerAddressCreate( {String? address1, diff --git a/lib/shopify/src/shopify_store.dart b/lib/shopify/src/shopify_store.dart index df6a2fd2..1d467b50 100644 --- a/lib/shopify/src/shopify_store.dart +++ b/lib/shopify/src/shopify_store.dart @@ -4,6 +4,7 @@ import 'package:flutter_simple_shopify/graphql_operations/queries/get_all_collec import 'package:flutter_simple_shopify/graphql_operations/queries/get_all_products_from_collection_by_id.dart'; import 'package:flutter_simple_shopify/graphql_operations/queries/get_all_products_on_query.dart'; import 'package:flutter_simple_shopify/graphql_operations/queries/get_collections_by_ids.dart'; +import 'package:flutter_simple_shopify/graphql_operations/queries/get_meta_field.dart'; import 'package:flutter_simple_shopify/graphql_operations/queries/get_metafileds_from_product.dart'; import 'package:flutter_simple_shopify/graphql_operations/queries/get_product_recommendations.dart'; import 'package:flutter_simple_shopify/graphql_operations/queries/get_products_by_ids.dart'; @@ -445,4 +446,23 @@ class ShopifyStore with ShopifyError { .map((e) => Metafield.fromGraphJson(e as Map)) .toList(); } + + Future> getMetaFields( + String id, {bool deleteThisPartOfCache = false}) async { + final WatchQueryOptions _options = WatchQueryOptions( + document: gql(getMetaField), + variables: { + 'ownerId': "gid://shopify/Product/$id"}); + final QueryResult result = + await ShopifyConfig.graphQLClient!.query(_options); + checkForError(result); + if (deleteThisPartOfCache) { + _graphQLClient!.cache.writeQuery(_options.asRequest, data: {}); + } + return (result.data!['product']['metafields']['edges'] + as List) + .map((e) => Metafield.fromGraphJson(e as Map)) + .toList(); + + } } diff --git a/pubspec.lock b/pubspec.lock index 8044c08b..3b8cda15 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -140,7 +140,7 @@ packages: name: collection url: "https://pub.dartlang.org" source: hosted - version: "1.15.0" + version: "1.16.0" convert: dependency: transitive description: @@ -168,7 +168,7 @@ packages: name: fake_async url: "https://pub.dartlang.org" source: hosted - version: "1.2.0" + version: "1.3.0" ffi: dependency: transitive description: @@ -344,7 +344,7 @@ packages: name: js url: "https://pub.dartlang.org" source: hosted - version: "0.6.3" + version: "0.6.4" json_annotation: dependency: transitive description: @@ -379,7 +379,7 @@ packages: name: material_color_utilities url: "https://pub.dartlang.org" source: hosted - version: "0.1.3" + version: "0.1.4" meta: dependency: transitive description: @@ -414,7 +414,7 @@ packages: name: path url: "https://pub.dartlang.org" source: hosted - version: "1.8.0" + version: "1.8.1" path_provider_linux: dependency: transitive description: @@ -449,7 +449,7 @@ packages: name: platform url: "https://pub.dartlang.org" source: hosted - version: "3.1.2" + version: "3.1.0" plugin_platform_interface: dependency: transitive description: @@ -519,7 +519,7 @@ packages: name: shared_preferences_linux url: "https://pub.dartlang.org" source: hosted - version: "2.1.2" + version: "2.1.1" shared_preferences_macos: dependency: transitive description: @@ -547,7 +547,7 @@ packages: name: shared_preferences_windows url: "https://pub.dartlang.org" source: hosted - version: "2.1.2" + version: "2.1.1" shelf: dependency: transitive description: @@ -587,7 +587,7 @@ packages: name: source_span url: "https://pub.dartlang.org" source: hosted - version: "1.8.1" + version: "1.8.2" stack_trace: dependency: transitive description: @@ -629,7 +629,7 @@ packages: name: test_api url: "https://pub.dartlang.org" source: hosted - version: "0.4.8" + version: "0.4.9" timing: dependency: transitive description: @@ -713,7 +713,7 @@ packages: name: vector_math url: "https://pub.dartlang.org" source: hosted - version: "2.1.1" + version: "2.1.2" watcher: dependency: transitive description: @@ -750,5 +750,5 @@ packages: source: hosted version: "3.1.0" sdks: - dart: ">=2.15.0 <3.0.0" - flutter: ">=2.10.1" + dart: ">=2.17.0-0 <3.0.0" + flutter: ">=2.10.0"