client library

Classes

Simple header-based authentication link that adds headerKey: getToken() to every request.
ConnectionAck
The server will send this acknowledgment message after receiving the init command from the client if the init was successful.
ConnectionError
The server will send this error message after receiving the init command from the client if the init was not successful.
ConnectionKeepAlive
The server will send this message to keep the connection alive
Context
A Context to be passed along with a Request.
ContextEntry
Entry in the Context.
A Link to deduplicate Requests
DefaultPolicies
The default Policies to set for each client action.
ErrorLink allows interception of GraphQL errors (using onGraphQLError) and LinkExceptions (using onException).
ErrorLocation
Location of a GraphQL error in the request document
FetchMoreOptions
options for fetchMore operations
Fragment
A fragment in a document, optionally defined by fragmentName
FragmentRequest
Cache access request of fragment with variables.
GraphQLCache
Optimistic GraphQL Entity cache with normalize TypePolicy support and configurable store.
GraphQLClient
Universal GraphQL Client with configurable caching and link system. modelled after the apollo-client.
GraphQLDataProxy
A proxy to the normalized data living in our store.
GraphQLError
GraphQL Error returned if execution fails
GraphQLProtocol
ALL protocol supported by the library
GraphQLSocketMessage
Base type for representing a server-client subscription message.
GraphQLWebSocketChannel
HiveStore
A simple HttpLink implementation.
HttpLinkHeaders
HTTP link headers
HttpLinkResponseContext
HTTP link Response Context
InitOperation
After establishing a connection with the server, the client will send this message to tell the server that it is ready to begin sending new subscription queries.
InMemoryStore
Simplest possible Map-backed store
JsonSerializable
DocumentNode-based GraphQL execution interface
MessageTypes
These messages represent the structures used for Client-server communication in a GraphQL web-socket subscription. Each message is represented in a JSON format where the data type is denoted by the type field. A list of constants used for identifying message types
MultiSourceResult<TParsed>
MutationCallbackHandler<TParsed>
Handles execution of mutation update, onCompleted, and onError callbacks
MutationOptions<TParsed extends Object?>
ObservableQuery<TParsed>
An Observable/Stream-based API for both queries and mutations.
Operation
An operation in a document, optionally defined by operationName
PingMessage
Policies
Container for supplying fetch, error, and cacheReread policies.
PongMessage
QueryCallbackHandler<TParsed>
Handles execution of query callbacks
QueryManager
QueryOptions<TParsed extends Object?>
Query options.
QueryPayload
Represent the payload used during a Start query operation. The operationName should match one of the top level query definitions defined in the query provided. Additional variables can be provided and sent to the server for processing.
QueryResult<TParsed extends Object?>
A single operation result
Request
Execution request of an operation with variables.
RequestExtensionsThunk
Exposes Request extensions
RequestSerializer
JSON Request serializer.
Response
Execution response
ResponseExtensions
Extensions returned with the response
ResponseParser
JSON Response parser
SocketClient
Wraps a standard web socket instance to marshal and un-marshal the server / client payloads into dart object representation.
SocketClientConfig
SocketSubProtocol
All the protocol supported by the library
StartOperation
A message to tell the server to create a subscription. The contents of the query will be defined by the payload request. The id provided will be used to tag messages such that they can be identified for this subscription instance. id values should be unique and not be re-used during the lifetime of the server.
StopOperation
Tell the server to stop sending subscription data for a particular subscription instance. See StartOperation.
Store
Raw key-value datastore API leveraged by the Cache
SubscribeOperation
SubscriptionComplete
Server message to the client to indicate that no more data will be sent for a particular subscription instance.
SubscriptionData
Data sent from the server to the client with subscription data or error payload. The user should check the errors result before processing the data value. These error are from the query resolvers.
SubscriptionError
Errors sent from the server to the client if the subscription operation was not successful, usually due to GraphQL validation errors.
SubscriptionListener
SubscriptionNext
SubscriptionOptions<TParsed extends Object?>
TerminateOperation
The client sends this message to terminate the connection.
UnknownData
Not expected to be created. Indicates there are problems parsing the server response, or that new unsupported types have been added to the subscription implementation.
WatchQueryOptions<TParsed extends Object?>
A Universal Websocket Link implementation to support the websocket transport. It supports subscriptions, query and mutation operations as well.

Enums

CacheRereadPolicy
CacheRereadPolicy determines whether and how cache data will be merged into the final QueryResult data before it is returned.
ErrorPolicy
ErrorPolicy determines the level of events for GraphQL Errors in the execution result. The options are:
FetchPolicy
FetchPolicy determines where the client may return a result from.
PartialDataCachePolicy
Determines how partial data should be handled when written to the cache
QueryLifecycle
Lifecycle states for ObservableQuery.lifecycle
QueryResultSource
The source of the result data contained
SocketConnectionState

Functions

coalesceErrors({List<GraphQLError>? graphqlErrors, LinkException? linkException, List? raw, OperationException? exception}) OperationException?
(graphqlErrors?, exception?) => exception?
gql(String document) → DocumentNode
Parse a GraphQL document into a DocumentNode, automatically adding __typenames
shouldRespondEagerlyFromCache(FetchPolicy? fetchPolicy) bool
shouldStopAtCache(FetchPolicy? fetchPolicy) bool
translateFailure(Object failure, StackTrace trace) LinkException
willAlwaysExecuteOnNetwork(FetchPolicy? policy) bool

Typedefs

ContextUpdater<T> = T Function(T entry)
ErrorHandler = Stream<Response>? Function(Request request, NextLink forward, Response response)
A handler of GraphQL errors.
ExceptionHandler = Stream<Response>? Function(Request request, NextLink forward, LinkException exception)
A handler of Link Exceptions.
GetInitPayload = FutureOr Function()
GetRequestExtensions = dynamic Function(Request request)
HttpResponseDecoder = FutureOr<Map<String, dynamic>?> Function(Response httpResponse)
LinkFunction = Stream<Response> Function(Request request, [NextLink? forward])
Link as a function
LinkRouter = Link Function(Request request)
A function which returns a Link based on contents Request
Type of the forward function
OnData<TParsed> = FutureOr<void> Function(QueryResult<TParsed>? result)
Side effect to register for execution when data is received
OnError = FutureOr<void> Function(OperationException? error)
OnException = FutureOr<String> Function(HttpLinkServerException exception)
OnMutationCompleted = FutureOr<void> Function(Map<String, dynamic>? data)
OnMutationUpdate<TParsed> = FutureOr<void> Function(GraphQLDataProxy cache, QueryResult<TParsed>? result)
OnQueryComplete = FutureOr<void> Function(Map<String, dynamic> data)
OnQueryError = FutureOr<void> Function(OperationException? error)
UpdateQuery = Map<String, dynamic>? Function(Map<String, dynamic>? previousResultData, Map<String, dynamic>? fetchMoreResultData)
merge fetchMore result data with earlier result data
VariableEncoder = Object Function(Object t)
WebSocketConnect = FutureOr<WebSocketChannel> Function(Uri uri, Iterable<String>? protocols)
A definition for functions that returns a connected WebSocketChannel

Exceptions / Errors

CacheMisconfigurationException
Failure occurring when the structure of data does not match that of the request operation document.
CacheMissException
A failure to find a response from the cache.
ContextReadException
Exception occurring when reading from the context
ContextWriteException
Exception occurring when writing to the context
HttpLinkParserException
Exception occurring when parsing fails.
HttpLinkServerException
Exception occurring when network fails or parsed response is missing both data and errors.
LinkException
A base class for exceptions thrown by links
MismatchedDataStructureException
A failure due to a data structure mismatch between the data and the expected structure based on the request operation document.
NetworkException
Exception occurring when there is a network-level error. This constructor is deprecated, use NetworkException.fromException instead.
OperationException
Container for both graphqlErrors returned from the server and any linkException that caused a failure.
PartialDataException
Exception occurring when structurally valid data cannot be resolved for an expected field.
RequestFormatException
Exception occurring when a terminating link tries to serialize the request
ResponseFormatException
Exception occurring when a terminating link tries to parse the response
ServerException
Exception occurring when network fails or parsed response is missing both data and errors
UnexpectedResponseStructureException
Failure occurring when the structure of the parsedResponse data does not match that of the request operation document.
UnknownException
Exception occurring when an unhandled, non-link exception is thrown during execution