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.

Ferry request architecture


Ferry is made up of several individual packages:

versionpackage:ferryCore TypedLinks, including the Client itself
versionpackage:ferry_cacheNormalized, strongly typed optimistic cache
versionpackage:ferry_execStrongly typed GraphQL execution interface
versionpackage:ferry_flutterFlutter Widgets for GraphQL Operations
versionpackage:ferry_generatorDart Type Generator for GraphQL Operations
versionpackage:ferry_storeData Persistence for ferry_cache
versionpackage:ferry_hive_storeHive implementation of ferry_store
versionpackage:normalizeNormalization / denormalization of GraphQL data