flutter_graphql_client
library
Classes
-
ActionCableLink
-
Create a new Link for Graphql subscription that is backed by Rails ActionCable websocket
Example:
-
AuthLink
-
Simple header-based authentication link that adds headerKey:
getToken()
to every request.
-
CacheProvider
-
-
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.
-
DedupeLink
-
A Link to deduplicate Requests
-
DefaultPolicies
-
The default Policies to set for each client action.
-
ErrorLink
-
ErrorLink allows interception of GraphQL errors (using onGraphQLError)
and LinkExceptions (using onException).
-
ErrorLocation
-
Location of a GraphQL error in the request document
-
ErrorModel
-
-
FetchMoreOptions
-
options for fetchMore operations
-
FlutterGraphqlClient
-
-
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
.
-
GraphQLConsumer
-
-
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
-
GraphQLProvider
-
-
GraphQLService
-
-
GraphQLSocketMessage
-
Base type for representing a server-client subscription message.
-
GraphQLWebSocketChannel
-
-
HiveStore
-
-
HttpLink
-
A simple HttpLink implementation.
-
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
-
-
Link
-
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>
-
-
Mutation<TParsed>
-
Builds a Mutation widget based on the a given set of MutationOptions
that streams QueryResults into the MutationBuilder.
-
MutationCallbackHandler<TParsed>
-
Handles execution of mutation
update
, onCompleted
, and onError
callbacks
-
MutationHookResult<TParsed>
-
-
MutationOnClient<TParsed>
-
Builds a MutationOnClient widget based on the a given set of MutationOptions
that streams QueryResults into the MutationBuilder.
-
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
-
PassthroughLink
-
-
PingMessage
-
-
Policies
-
Container for supplying fetch, error, and cacheReread policies.
-
PongMessage
-
-
Query<TParsed>
-
Builds a Query widget based on the a given set of QueryOptions
that streams QueryResults into the QueryBuilder.
-
QueryCallbackHandler<TParsed>
-
Handles execution of query callbacks
-
QueryHookResult<TParsed>
-
-
QueryManager
-
-
QueryOnClient<TParsed>
-
Builds a QueryOnClient widget based on the a given set of QueryOptions
that streams QueryResults into the QueryBuilder.
-
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
-
ResponseModel
-
-
ResponseParser
-
JSON Response parser
-
ResultAccumulator<T>
-
Accumulate stream results into a List.
-
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
-
-
Subscription<TParsed>
-
Creats a subscription with GraphQLClient.subscribe.
-
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
-
-
SubscriptionOnClient<TParsed>
-
Creats a subscription widget like Subscription but
with an external client.
-
SubscriptionOptions<TParsed extends Object?>
-
-
TerminateOperation
-
The client sends this message to terminate the connection.
-
Token
-
-
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?>
-
-
WebSocketLink
-
A Universal Websocket Link implementation to support the websocket transport.
It supports subscriptions, query and mutation operations as well.
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 __typename
s
-
initHiveForFlutter({String? subDir, Iterable<String> boxes = const [HiveStore.defaultBoxName]})
→ Future<void>
-
Initializes Hive with the path from
getApplicationDocumentsDirectory
.
-
optimizedDeepEquals(Object? a, Object? b)
→ bool
-
Compare two json-like objects for equality
a
and b
must be one of
-
shouldRespondEagerlyFromCache(FetchPolicy? fetchPolicy)
→ bool
-
-
shouldStopAtCache(FetchPolicy? fetchPolicy)
→ bool
-
-
translateFailure(Object failure, StackTrace trace)
→ LinkException
-
-
useGraphQLClient()
→ GraphQLClient
-
-
useMutation<TParsed>(MutationOptions<TParsed> options)
→ MutationHookResult<TParsed>
-
-
useMutationOnClient<TParsed>(GraphQLClient client, MutationOptions<TParsed> options)
→ MutationHookResult<TParsed>
-
-
useQuery<TParsed>(QueryOptions<TParsed> options)
→ QueryHookResult<TParsed>
-
-
useQueryOnClient<TParsed>(GraphQLClient client, QueryOptions<TParsed> options)
→ QueryHookResult<TParsed>
-
-
useSubscription<TParsed>(SubscriptionOptions<TParsed> options, {OnSubscriptionResult<TParsed>? onSubscriptionResult})
→ QueryResult<TParsed>
-
-
useSubscriptionOnClient<TParsed>(GraphQLClient client, SubscriptionOptions<TParsed> options, {OnSubscriptionResult<TParsed>? onSubscriptionResult})
→ QueryResult<TParsed>
-
-
useWatchMutation<TParsed>(WatchQueryOptions<TParsed> options)
→ ObservableQuery<TParsed>
-
-
useWatchMutationOnClient<TParsed>(GraphQLClient client, WatchQueryOptions<TParsed> options)
→ ObservableQuery<TParsed>
-
-
useWatchQuery<TParsed>(WatchQueryOptions<TParsed> options)
→ ObservableQuery<TParsed>
-
-
useWatchQueryOnClient<TParsed>(GraphQLClient client, WatchQueryOptions<TParsed> options)
→ ObservableQuery<TParsed>
-
-
willAlwaysExecuteOnNetwork(FetchPolicy? policy)
→ bool
-
Typedefs
-
Accumulator<Element>
= List<Element>? Function(List<Element> previousValue, Element element)
-
Same as a fold combine for lists
-
ContextUpdater<T>
= T Function(T entry)
-
-
DeepEqualsFn
= bool Function(dynamic a, dynamic b)
-
-
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.
-
FetchMore<TParsed extends Object?>
= Future<QueryResult<TParsed>> Function(FetchMoreOptions options)
-
-
GetAuthToken
= FutureOr<String> Function()
-
A function that returns the token for authentication
-
GetInitPayload
= FutureOr Function()
-
-
GetRequestExtensions
= dynamic Function(Request request)
-
-
GraphQLConsumerBuilder
= Widget Function(GraphQLClient client)
-
-
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
-
MutationBuilder<TParsed>
= Widget Function(RunMutation<TParsed> runMutation, QueryResult<TParsed>? result)
-
-
NextLink
= Stream<Response> Function(Request 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)
-
-
OnSubscriptionResult<TParsed>
= void Function(QueryResult<TParsed> subscriptionResult, GraphQLClient? client)
-
-
QueryBuilder<TParsed>
= Widget Function(QueryResult<TParsed> result, {FetchMore<TParsed>? fetchMore, Refetch<TParsed>? refetch})
-
-
Refetch<TParsed extends Object?>
= Future<QueryResult<TParsed>?> Function()
-
-
RunMutation<TParsed>
= MultiSourceResult<TParsed> Function(Map<String, dynamic> variables, {Object? optimisticResult})
-
-
SubscriptionBuilder<TParsed>
= Widget Function(QueryResult<TParsed> result)
-
-
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