Closed isshort closed 2 years ago
we need an example for this!
You can use our endpoint https://api.chat.graphql-flutter.dev/graphql
My query is
client=GraphQLClient(
cache: GraphQLCache(),
link: "MY LINK"),
for example firstly I am getting list of restaurant in my query
final _restaurantList = await client.query(
QueryOptions( document: gql(path), variables: params, ), );
After getting my restaurantList I want to add a restaurant to my favorite list. Here favorite operation I'm making with http REST API
final _favorite = await _clientHttp.patch<Favorite>(
ApiConstant.instance.favoriteRestaurant,
fromJson: Favorite.fromJson,
body: {
'rowId': restaurantId,
},
);
After favoriting my restaurant when I recall my restaurant list with graphql query like this
final _restaurantList = await client.query( QueryOptions( document: gql(path), variables: params, ), );
The favorite is not updated
test('Favorite Restaurant equal to favorite list detail', () async { const restaurantId = 11;
/// In this query 11.restaurant = false final _restaurant1 = await _client.betaQueryList( path: RestaurantQuery.instance.restaurantListByCategoryId, fromJson: Restaurant.fromJson, model: restaurantModel, params: {'id': 3, 'page': 0, 'count': 10}, );
/// In this query 11.restaurant = true
final _favorite = await _clientHttp.patch
-/// In this query 11.restaurant = false did'nt update
final _restaurant = await _client.betaQueryList(
path: RestaurantQuery.instance.restaurantListByCategoryId,
fromJson: Restaurant.fromJson,
model: restaurantModel,
params: {'id': 3, 'page': 0, 'count': 10},
);
This the screen shot
Thanks Mr @vincenzopalazzo for your response me quickly I found my question at [beingadrian](https://github.com/beingadrian) issue It was with fetchPolicy
Graphql data is not updating without reloading the page
firstly I am running a graphql query example get list of product Than I'm doing update operation like favorite the product