Skip to content

Release 3.1.0: Flutter widgets and hooks, explicit nulls, enums, nodes, groups, shared packages - #14

Merged
ifmelate merged 32 commits into
masterfrom
feat/3.1
Oct 22, 2026
Merged

ifmelate merged 32 commits into
masterfrom
feat/3.1

Conversation

@ifmelate

Copy link
Copy Markdown
Owner

Release 3.1.0. All new options are off by default.

  • flutter_widgets / flutter_hooks: typed graphql_flutter widgets (<Op>Query, <Op>Mutation, <Op>Subscription) and hooks (use<Op>Query, use<Op>WatchQuery, use<Op>Mutation, use<Op>Subscription)
  • Explicit nulls: X.withNulls(...) and copyWith(x: null) on input and variables classes; variables classes get ==/hashCode and copyWith
  • enums: map a GraphQL enum to your own type, or set a per-enum fallback
  • nodes getter on Relay-style edges { node } connections (result and fragment data classes)
  • group_operations: directory: client.<group>.<operation>()
  • Several packages: types_import, fragment_imports, package: schema URLs
  • <op>QueryOptions takes onComplete / onError

Behaviour changes (input copyWith(x: null), input fromJson nulls, variables equality) are listed in CHANGELOG.md and MIGRATION.md.

The <op>QueryOptions functions take graphql's onComplete/onError callbacks, which graphql_flutter's Query widget and useQuery hook call. Options parameters are now described structurally so other generators can forward them.
With a group, an operation file records it in its header, imports the group file and adds its client methods to the group class through an extension delegating to the GraphQLClient extension.
Operations of the documents in one directory are grouped (client.users.getUser()); group files are exported by index.dart, deleted when their group has no operations left, and checked for names clashing with other files (BLD108).
Fragments declared by another package (fragment_imports) are passed with the URI of their library: operation classes and local fragments implement their interfaces and import that library, and fragments.dart declares local fragments only. With types_import, generated files import that types.dart.
types_import: no types.dart is written (one generated earlier is removed); index.dart exports the shared types. fragment_imports: the fragments of the other package are read through the build step from its lib/ (files listed via the package config), checked for name clashes with local fragments and declarations, and index.dart exports their library. schema_url may be a package: URI, read through the build step.
Without grouping, operation files are skipped entirely; only group files of earlier builds are looked for.
flutter_widgets: <Op>Query, <Op>Mutation and <Op>Subscription widgets wrapping graphql_flutter's Query/Mutation/Subscription (or the *OnClient variants with an explicit client), built on the typed options, so result.parsedData is typed. Mutations run through a typed Run<Op>Mutation function taking the variables class.

flutter_hooks: use<Op>Query, use<Op>WatchQuery, use<Op>Mutation (a record of a typed runMutation and the result) and use<Op>Subscription on graphql_flutter's hooks.

A trailing operation kind is not repeated (GetUserQuery -> GetUserQuery). A widget named like a schema type is reported as BLD108.
Generates both result type modes into a temporary Flutter package with graphql_flutter and flutter_hooks, requires a clean flutter analyze for lib/ and runs widget tests that pump every widget and hook with a GraphQLClient on a fake link. Tagged compile and flutter; skipped when flutter is not on PATH.
# Conflicts:
#	lib/src/client_extension_generator.dart
# Conflicts:
#	lib/src/client_extension_generator.dart
# Conflicts:
#	lib/src/client_extension_generator.dart
# Conflicts:
#	lib/src/client_extension_generator.dart
#	lib/src/type_generator.dart
Flutter widgets and hooks, explicit nulls for inputs and variables, the enums option, Relay nodes getters, operation groups and several packages, with options and error table rows. Also: variable defaults as of 3.0.1, selecting id for the normalized cache, and the license link pointing to master.
Input copyWith(x: null) and fromJson now keep explicit nulls, and variables compare by value.
@ifmelate
ifmelate merged commit 05ebbb4 into master Oct 22, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant