fresh_graphql 🍋

Pub build coverage style: effective dart License: MIT


A graphql link for built-in token refresh. Built to be used with fresh.

Overview

fresh_graphql is a graphql link which attempts to simplify custom API authentication by integrating token refresh and caching transparently. fresh_graphql is flexible and is intended to support custom token refresh mechanisms.

Usage

final freshLink = FreshLink(
  tokenStorage: InMemoryTokenStorage(),
  refreshToken: (token, client) {
    // Perform refresh and return new token
  },
);
final graphQLClient = GraphQLClient(
  cache: InMemoryCache(),
  link: Link.from([freshLink, HttpLink(uri: 'https://my.graphql.api')]),
);

Example

See the example for a complete sample application using fresh_graphql which integrates with api.graphql.jobs.

Libraries

fresh_graphql