simple_gql 1.1.0 simple_gql: ^1.1.0 copied to clipboard
A minimal library to do GraphQL queries and mutations (subscriptions not handled yet)
A simple GraphQL library. Quite minimal and hopefully easy to use. GQL Subscriptions are not handled yet.
Usage #
A simple usage example:
import 'package:simple_gql/simple_gql.dart';
main() {
try {
final response = await gql.query(
url: 'https://api.graph.cool/simple/v1/swapi',
query: r'''
query {
allPersons {
name
films {
director
}
}
}
''',
);
print(response);
} on GQLError catch(e){
print('here is a GraphQL error : $e');
} catch(e) {
print('unknown error. Usually due to a bad URL or problem with the connection');
print(e);
}
}