updateNoteInCart method

Future<Cart> updateNoteInCart({
  1. required String cartId,
  2. required String note,
})

update note in cart

Implementation

Future<Cart> updateNoteInCart({
  required String cartId,
  required String note,
}) async {
  final MutationOptions updateNote = MutationOptions(
    document: gql(updateNoteInCartMutation),
    variables: {
      'cartId': cartId,
      'note': note,
      'country': ShopifyLocalization.countryCode,
    },
  );
  QueryResult result = await _graphQLClient!.mutate(updateNote);
  checkForError(result, key: 'cartNoteUpdate', errorKey: 'userErrors');

  return Cart.fromJson(
      ((result.data!['cartNoteUpdate'] ?? const {})['cart'] ?? const {}));
}