performQuery method
Implementation
Future<QueryResult?> performQuery(
String gqlQuery, Map<String, dynamic> variables,
[String? token]) async {
requestCounter++;
try {
GraphQLClient _client = await getClient(token);
QueryResult result = await _client.query(QueryOptions(
document: gql(gqlQuery),
variables: variables,
fetchPolicy: FetchPolicy.networkOnly));
if (result.hasException) {
if (kDebugMode) {
print(
"Exception while performing query: ${result.exception.toString()}");
}
return null;
}
return result;
} catch (e) {
if (kDebugMode) {
print("Error while performing query: $e");
}
return null;
}
}