gqlify

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 using package: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 (in package:gqlify_runtime/testing.dart): test your app without a network.
  • Exceptions: GraphQLResponseException, GqlifyTransportException and GqlifyDecodingException, 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.

Libraries

gqlify_runtime
Runtime support for code generated by gqlify.
internal
Helpers referenced by generated code. Not part of the public API; may change between minor versions together with the generator.
testing
Test helpers for code generated by gqlify. No network access required.