gqlify_runtime 0.1.0
gqlify_runtime: ^0.1.0 copied to clipboard
Lightweight, pure-Dart runtime for code generated by gqlify: injectable transports, typed operation results and explicit GraphQL error semantics.
gqlify_runtime #
The small runtime that code generated by gqlify runs on. You add it as a normal dependency, and gqlify does the rest.
dependencies:
gqlify_runtime: ^0.1.0
Most of the time, the only thing you'll touch directly is the transport:
final api = GqlifyClient(
transport: HttpTransport(
Uri.parse('https://api.example.com/graphql'),
headersBuilder: (_) async => {'authorization': 'Bearer ${await token()}'},
timeout: const Duration(seconds: 15),
),
);
What's inside:
HttpTransport: GraphQL over HTTP usingpackage:http. It works on the Dart VM, Flutter and the web.GqlifyTransport: a single-method interface, in case you want to plug in Dio, a cache or anything else.MockTransport(inpackage:gqlify_runtime/testing.dart): test your app without a network.- Exceptions:
GraphQLResponseException,GqlifyTransportExceptionandGqlifyDecodingException, so you always know what went wrong.
No Flutter dependency and no global state.
Use the same minor version as gqlify (0.1.x with 0.1.x). See the
gqlify README to get started.
