graphql_flutter
5.3.0, released 8 months ago by zino.company
A GraphQL client for Flutter with widget wrappers and hooks.
What it does
Provides an idiomatic Flutter API, widgets, and hooks to execute GraphQL queries, mutations, and subscriptions. It supports caching, optimistic UI updates, and pagination out of the box.
AI-written summary of version 5.3.0, based on the package's README and metadata. Report an inaccuracy
Use it when
- You are building a Flutter app that communicates with a GraphQL backend.
- You want declarative Query and Mutation widgets or hooks in your UI.
Skip it when
- Your backend uses a standard REST API instead of GraphQL.
- You prefer an extremely lightweight HTTP client without schema caching.
Strengths
- Comprehensive feature set including caching, pagination, and optimistic mutations.
- Supports both traditional Flutter widgets and flutter_hooks.
- Built-in integration for local persistence stores like Hive.
Weaknesses
- Requires specific Android build configurations (Java 17 and Gradle 8.4).
- Can add substantial complexity for simple applications.
Setup
- Kind
- Flutter widgets
- Effort
- Medium
- Code generation
- No
- Direct dependencies
- 9
Requires initializing Hive for caching, wrapping your app with GraphQLProvider, and updating Android settings to Java 17 and Gradle 8.4.
ValueNotifier<GraphQLClient> client = ValueNotifier(GraphQLClient(link: link, cache: GraphQLCache(store: HiveStore())));
GraphQLProvider(
client: client,
child: MaterialApp(
home: Query(
options: QueryOptions(document: gql(readRepositories)),
builder: (QueryResult result, { VoidCallback? refetch, FetchMore? fetchMore }) {
if (result.isLoading) return Text('Loading');
return Text('Loaded');
},
),
),
);Alternatives
Packages that do the same job and could replace graphql_flutter.
- ferry
A GraphQL client for Dart and Flutter with code generation and normalized caching.
74Compare - dartssh2
SSH and SFTP client written in pure Dart
87Compare - ferry_flutter
Flutter widgets for executing GraphQL operations using the ferry client
62Compare - graphql_codegen
Generate Dart serializers and client helpers from GraphQL queries and schemas.
78Compare
Works with
Packages commonly used together with graphql_flutter: ones it builds on, ones built on it, and its own family.
- plugin_platform_interfacegraphql_flutter depends on itReusable base class for platform interfaces of Flutter federated plugins.
- path_providergraphql_flutter depends on itProvides Flutter APIs to locate common filesystem directories on Android, iOS, macOS, Linux and Windows.
- connectivity_plusgraphql_flutter depends on itDiscover the state of network connectivity (WiFi, mobile, ethernet) on Android, iOS, Web and desktops.
- hive_cegraphql_flutter depends on itA lightweight and fast NoSQL key-value database written in pure Dart.
- graphqlgraphql_flutter depends on itA Dart GraphQL client offering queries, mutations, subscriptions and cache management.
- flutter_hooksgraphql_flutter depends on itA Flutter implementation of React hooks for managing widget life-cycle and code reuse.
- requests_inspectorBuilt on graphql_flutterLog, inspect, and share REST and GraphQL requests by shaking your phone.
- shopify_flutterBuilt on graphql_flutterConnects your Shopify store with your Flutter application using the Storefront API.