How It Works
When you run the Ferry code generator, it searches your src
directory for .graphql
files and creates an OperationRequest
class for every Query, Mutation, and Subscription it finds. The request includes everything needed to execute the operation, including the operation itself, any variables, optimistic data, etc.
You can execute these requests by passing them to Client.request()
, which adds the request to the Client.requestController
, and listening to the returned Stream for an OperationResponse
. Responses are resolved by either the provided Link or from the Cache, depending on the request's FetchPolicy.
Results can be refetched or paginated by manually adding additional requests to the Client.requestController
.
Packages
Ferry is made up of several individual packages:
Pub | Package | Description |
---|---|---|
package:ferry | Core TypedLinks, including the Client itself | |
package:ferry_cache | Normalized, strongly typed optimistic cache | |
package:ferry_exec | Strongly typed GraphQL execution interface | |
package:ferry_flutter | Flutter Widgets for GraphQL Operations | |
package:ferry_generator | Dart Type Generator for GraphQL Operations | |
package:ferry_store | Data Persistence for ferry_cache | |
package:ferry_hive_store | Hive implementation of ferry_store | |
package:normalize | Normalization / denormalization of GraphQL data |