I am trying to use Ferry with Flutter using the official documentation . I have placed my schema.graphql into my project and it has auto generated the necessary files, which has enabled me to extract my first query Login no problem.
I have created a build.yaml file to which I have posted the following code....
targets:
$default:
builders:
gql_build|schema_builder:
enabled: true
gql_build|ast_builder:
enabled: true
gql_build|data_builder:
enabled: true
options:
schema: WelcomeApp|lib/schema.graphql
gql_build|var_builder:
enabled: true
options:
schema: WelcomeApp|lib/schema.graphql
gql_build|serializer_builder: <-------------------ERROR ON THIS LINE
enabled: true
options:
schema: WelcomeApp|lib/schema.graphql
ferry_generator|req_builder:
enabled: true
options:
schema: WelcomeApp|lib/schema.graphql
And added my query into a file called login.graphql.
However when calling flutter
pub run build_runner watch --delete-conflicting-outputs
it builds some of the autogenerated files associated with the login.schema but the login.req.gql.dart is full of errors. I believe I am missing all the files with the .g.dart extension. I receive the following error associated with line 15 in the build.yaml file....
[WARNING] Configuring `gql_build:serializer_builder` in target `WelcomeApp: WelcomeApp` but this is not a known Builder
I believe the missing files that are not being auto generated are....
login.data.gql.g.dart
login.req.gql.g.dart
login.var.gql.g.dart
Thanks for any help you can provide.
I solved it by adding gql_build in pubspec.yaml dependencies.
dependencies:
ferry:
gql_http_link:
get: ^4.1.1
get_storage: ^2.0.1
get_it:
gql_build: ^0.1.4+2
dependency_overrides:
analyzer: ^0.41.2`
a few of the builders have been removed, see https://github.com/gql-dart/ferry/blob/master/examples/pokemon_explorer/build.yaml for latest one:
targets:
$default:
builders:
ferry_generator|graphql_builder:
enabled: true
options:
schema: pokemon_explorer|lib/schema.graphql
ferry_generator|serializer_builder:
enabled: true
options:
schema: pokemon_explorer|lib/schema.graphql
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With