gql_dio_link 1.0.1+1 gql_dio_link: ^1.0.1+1 copied to clipboard
Similar to gql_http_link, gql_dio_link is a GQL Terminating Link to execute requests via Dio using JSON
See https://github.com/gql-dart/gql/tree/master/examples/gql_example_dio_link
final client = dio.Dio();
final Link link = DioLink(
graphqlEndpoint,
client: client,
);
final res = await link
.request(Request(
operation: Operation(document: gql.parseString(
"""{
countries(filter:{currency:{eq:"EGP"}}){
name
}
}""",
)),
))
.first;
final countryName = res.data["countries"][0]["name"] as String;
print("The country that uses EGP as a form of curruncy is ${countryName}");