flutter_robusta_graphql library
Providing bridge to integrate GraphQL Flutter with Robusta.
Classes
- 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
- FetchMoreOptions
- options for fetchMore operations
- FlutterGraphQLExtension
- An extension to integrate GraphQL features for Robusta runner.
- Fragment
- A fragment in a document, optionally defined by fragmentName
- FragmentRequest
- Cache access request of fragment with variables.
- GraphQLCache
-
Optimistic GraphQL Entity cache with
normalizeTypePolicysupport and configurable store. - GraphQLClient
-
Universal GraphQL Client with configurable caching and link system.
modelled after the
apollo-client. - GraphQLClientAware
- An interface to mark classes aware GraphQLClient and should be set after instance of it created.
- GraphQLClientSettings
- Store settings of GraphQLClient.
- 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
- GraphQLSocketMessage
- Base type for representing a server-client subscription message.
- GraphQLWebSocketChannel
- HiveStore
- HttpLink
- 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
- 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
typefield. 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, andonErrorcallbacks -
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
- 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.
- 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.
Enums
- CacheRereadPolicy
-
CacheRereadPolicy determines whether and how cache data will be merged into
the final QueryResult
databefore 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
- ToggleConnectionState
Mixins
- GraphQLClientSettable
- Support to quick implement GraphQLClientAware.
Extensions
- FragmentDataValid on FragmentRequest
- Getters on QueryResultSource
- GraphQLGetter on WebSocketChannel
- OperationDataValid on Request
- OperationRequestHelper on Operation
- OperationTypeExtension on Operation
- WithType on Request
Properties
- gqlAsyncDeepEquals ↔ AsyncDeepEqualsFn
-
The async equality function used for comparing cached and new data
during asynchronous operations like rebroadcast checks.
getter/setter pair
- gqlDeepEquals ↔ DeepEqualsFn
-
The equality function used for comparing cached and new data
in synchronous contexts like operator overrides or custom logic.
getter/setter pair
-
graphQLClientProvider
→ Provider<
GraphQLClient> -
Providing GraphQLClient to interact with your upstream API.
final
Functions
-
coalesceErrors(
{List< GraphQLError> ? graphqlErrors, LinkException? linkException, List? raw, OperationException? exception}) → OperationException? -
(graphqlErrors?, exception?) => exception? -
gql(
String document) → DocumentNode -
Parse a GraphQL
documentinto aDocumentNode, automatically adding__typenames -
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
aandbmust 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
-
AsyncDeepEqualsFn
= Future<
bool> Function(dynamic a, dynamic b) - CacheFactory = GraphQLCache Function(ProviderContainer)
-
Callback to create GraphQLCache with
ProviderContainergiven to solve dependencies. -
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< Function(FetchMoreOptions options)TParsed> > - GetInitPayload = FutureOr Function()
- GetRequestExtensions = dynamic Function(Request request)
- GraphQLConsumerBuilder = Widget Function(GraphQLClient client)
-
HttpResponseDecoder
= FutureOr<
Map< Function(Response httpResponse)String, dynamic> ?> - LinkFactory = Link Function(ProviderContainer)
-
Callback to create Link with
ProviderContainergiven to solve dependencies. -
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
forwardfunction -
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< Function()TParsed> ?> -
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
Exceptions / Errors
- CacheMisconfigurationException
-
Failure occurring when the structure of data
does not match that of the request
operationdocument. - 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
dataanderrors. - 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
operationdocument. - 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
dataanderrors - UnexpectedResponseStructureException
-
Failure occurring when the structure of the parsedResponse
datadoes not match that of the requestoperationdocument. - UnknownException
- Exception occurring when an unhandled, non-link exception is thrown during execution