customMutation method

Future<Map<String, dynamic>?> customMutation({
  1. required String gqlMutation,
  2. Map<String, dynamic> variables = const {},
  3. bool adminAccess = false,
})

Returns a Map of String and dynamic.

Returns the data of the custom mutation.

adminAccess is optional, if set to true, the admin access token will be used.

Implementation

Future<Map<String, dynamic>?> customMutation({
  required String gqlMutation,
  Map<String, dynamic> variables = const {},
  bool adminAccess = false,
}) async {
  final MutationOptions _options = MutationOptions(
    document: gql(gqlMutation),
    variables: variables,
  );
  final QueryResult result = adminAccess
      ? await _graphQLClientAdmin!.mutate(_options)
      : await _graphQLClient!.mutate(_options);
  checkForError(result);
  return result.data;
}