Skip to content

Instantly share code, notes, and snippets.

@joaquinacuna
Created November 3, 2020 20:38
Show Gist options
  • Save joaquinacuna/17820f4ae3eed2c4c3774de9bbcf7036 to your computer and use it in GitHub Desktop.
Save joaquinacuna/17820f4ae3eed2c4c3774de9bbcf7036 to your computer and use it in GitHub Desktop.
GraphQL dart configuration file
import "package:flutter/material.dart";
import "package:graphql_flutter/graphql_flutter.dart";
class GraphQLConfiguration {
static HttpLink httpLink = HttpLink(
uri: "http://127.0.0.1:8000/graphql",
);
ValueNotifier<GraphQLClient> client = ValueNotifier(
GraphQLClient(
link: httpLink,
cache: OptimisticCache(dataIdFromObject: typenameDataIdFromObject),
),
);
GraphQLClient clientToQuery() {
return GraphQLClient(
cache: OptimisticCache(dataIdFromObject: typenameDataIdFromObject),
link: httpLink,
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment