getSingleProductWishlist method
Implementation
Future getSingleProductWishlist(String userId, String productId) async {
GraphQLClient _client = graphQLConfiguration.clientToQuery();
var orderListGql = """
query getSingleProductWishlist(\$userId: String, \$productId: String) {
getSingleProductWishlist(userId: \$userId, productId: \$productId) {
productId
_id
}
}
""";
final vble = {"userId": userId, "productId": productId};
QueryResult result = await _client.query(QueryOptions(
document: gql(orderListGql),
variables: vble,
fetchPolicy: FetchPolicy.networkOnly,
));
if (!result.hasException) {
var allWishList = result.data!['getSingleProductWishlist'];
if (allWishList != null && allWishList.length > 0) {
allWishList = SingleWishlist.fromJson(allWishList);
return allWishList != null ? true : false;
}
}
return false;
}