Last updated:
0 purchases
flutter graphql hooks
Flutter GraphQL Hooks 🪝
Introduction #
This package exposes an apollo-like set of hooks to be used with flutter,
it's meant to be used together with the graphql_flutter package and it's
based on it's latest implementation.
It can be used along with artemis to provide strongly typed hooks, example:
final query = GetRoomsQuery(variables: GetRoomsArguments(limit: 10, offset: 0));
final rooms = useQuery(QueryOptions(
document: query.document,
variables: query.getVariablesMap(),
));
final loading = rooms.result.loading;
final error = rooms.result.error;
final data = query.parse(rooms.result.data);
// Data will no longer be a [Map<String, dynamic>] and will have proper typings!
copied to clipboard
Installing #
dependencies:
flutter_graphql_hooks:
copied to clipboard
Notes #
In order to use the hooks, a GraphqlProvider must exist on the build context.
Otherwise you'll need to manually pass the client in the hook as a parameter like:
final rooms = useQuery(QueryOptions(
document: query.document,
variables: query.getVariablesMap(),
), client: myGraphqlClient);
copied to clipboard
For personal and professional use. You cannot resell or redistribute these repositories in their original state.
There are no reviews.