updateWishlist method
Implementation
Future<bool> updateWishlist(String userId, String packId) async {
String wishlistGql =
"""mutation changeWishlist(\$userId: String, \$packId: String) {
changeWishlist(userId: \$userId, packId: \$packId) {
_id
__typename
}
}""";
GraphQLConfiguration graphQLConfiguration = GraphQLConfiguration();
GraphQLClient _client = graphQLConfiguration.clientToQuery();
final vble = {"packId": packId, "userId": userId};
QueryResult result = await _client.mutate(
MutationOptions(
document: gql(wishlistGql),
variables: vble,
),
);
if (!result.hasException) {
var wishlist = result.data!['changeWishlist'];
if (wishlist != null && wishlist["_id"] != null) {
return true;
} else {
return true;
}
}
return false;
}