Skip to content

Instantly share code, notes, and snippets.

@Quingsley
Created October 5, 2022 11:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Quingsley/63c311c9e6ad1d7c7fa14267fffb51ef to your computer and use it in GitHub Desktop.
Save Quingsley/63c311c9e6ad1d7c7fa14267fffb51ef to your computer and use it in GitHub Desktop.
mutation
import 'dart:convert';
import 'package:http/http.dart' as http;
void main() async{
final graphQLQuery = {
'query': '''mutation Mutation {
upsertCourse(classId: 1, title: "english", description:"fff" , creatorId: 1) {
id
title
classId
description
orderNum
}
}'''
};
final response = await http
.post(Uri.parse('https://gentle-hotels-judge-197-232-145-163.loca.lt'),
headers: {'Content-Type': 'application/json'},
body: jsonEncode(graphQLQuery)
);
print(jsonDecode(response.body));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment