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