getAllWishList method

Future getAllWishList(
  1. String userId
)

Implementation

Future getAllWishList(String userId) async {
  GraphQLClient _client = graphQLConfiguration.clientToQuery();

  var orderListGql = """
          query getAllWishlist(\$userId: String) {
          getAllWishlist(userId: \$userId) {
            _id
            packId
            setId
            packImage
            packName
            setPrice
            __typename
          }
        }
          """;

  final vble = {"userId": userId};
  QueryResult result = await _client.query(QueryOptions(
    document: gql(orderListGql),
    variables: vble,
    fetchPolicy: FetchPolicy.networkOnly,
  ));
  if (!result.hasException) {
    var allWishList = result.data!['getAllWishlist'];

    if (allWishList != null && allWishList.length > 0) {
      allWishList = allWishListFromJson(allWishList);
      return allWishList;
    }
  }
  return allWishList;
}