GraphQLClient class

Universal GraphQL Client with configurable caching and link system. modelled after the apollo-client.

The link is a Link over which GraphQL documents will be resolved into a Response. The cache is the GraphQLCache to use for caching results and optimistic updates.

The client automatically rebroadcasts watched queries when their underlying data changes in the cache. To skip the data comparison check, alwaysRebroadcast: true can be passed. NOTE: This flag was added ot accomodate the old default behavior. It is marked @experimental because it may be deprecated in the future.

Implemented types

Constructors

GraphQLClient({@required Link link, @required GraphQLCache cache, DefaultPolicies defaultPolicies, @experimental bool alwaysRebroadcast = false})
Constructs a GraphQLClient given a Link and a Cache.

Properties

cache GraphQLCache
The initial Cache to use in the data store.
final
defaultPolicies DefaultPolicies
The default Policies to set for each client action
read / write
hashCode int
The hash code for this object. [...]
read-only, inherited
The Link over which GraphQL documents will be resolved into a Response.
final
queryManager QueryManager
read / write
runtimeType Type
A representation of the runtime type of the object.
read-only, inherited

Methods

fetchMore(FetchMoreOptions fetchMoreOptions, {QueryOptions originalOptions, QueryResult previousResult}) Future<QueryResult>
Fetch more results and then merge them with the given previousResult according to FetchMoreOptions.updateQuery. [...]
mutate(MutationOptions options) Future<QueryResult>
This resolves a single mutation according to the MutationOptions specified and returns a Future which resolves with the QueryResult or throws an Exception.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed. [...]
inherited
query(QueryOptions options) Future<QueryResult>
This resolves a single query according to the QueryOptions specified and returns a Future which resolves with the QueryResult or throws an Exception. [...]
readFragment(FragmentRequest fragmentRequest, {bool optimistic = true}) Map<String, dynamic>
pass through to cache.readFragment
override
readQuery(Request request, {bool optimistic = true}) Map<String, dynamic>
pass through to cache.readQuery
override
resetStore({bool refetchQueries = true}) Future<List<QueryResult>>
Resets the contents of the store with cache.store.reset() and then refetches of all queries unless refetchQueries is disabled
subscribe(SubscriptionOptions options) Stream<QueryResult>
This subscribes to a GraphQL subscription according to the options specified and returns a Stream which either emits received data or an error. [...]
toString() String
A string representation of this object. [...]
inherited
watchMutation(WatchQueryOptions options) ObservableQuery
watchMutation is the same as watchQuery, but with a different defaultPolicies that are more appropriate for mutations. [...]
watchQuery(WatchQueryOptions options) ObservableQuery
This registers a query in the QueryManager and returns an ObservableQuery based on the provided WatchQueryOptions. [...]
writeFragment(FragmentRequest fragmentRequest, {bool broadcast = true, Map<String, dynamic> data}) → void
pass through to cache.writeFragment and then rebroadcast any changes.
override
writeQuery(Request request, {Map<String, dynamic> data, bool broadcast = true}) → void
pass through to cache.writeQuery and then rebroadcast any changes.
override

Operators

operator ==(Object other) bool
The equality operator. [...]
inherited