GraphQL Client Repository
A Flutter package that provides a wrapper for GraphQL client to be used in repositories. This package simplifies the integration of GraphQL in your Flutter applications by providing a clean and maintainable way to handle GraphQL operations.
Features
- 🚀 Easy integration with GraphQL APIs
- 📦 Repository pattern implementation
- 🔄 Type-safe GraphQL operations
- 🛠️ Built on top of the official
graphql
package - 📝 Clean and maintainable code structure
Getting started
Add this to your package's pubspec.yaml
file:
dependencies:
graphql_client_repository: ^1.0.0
Usage
Here's a simple example of how to use this package:
import 'package:graphql_client_repository/graphql_client_repository.dart';
// Create your repository
class UserRepository extends GraphQLRepository {
Future<User> getUser(String id) async {
final result = await query(
document: gql('''
query GetUser(\$id: ID!) {
user(id: \$id) {
id
name
email
}
}
'''),
variables: {'id': id},
);
return User.fromJson(result.data!['user']);
}
}
Additional information
This package is built on top of the official graphql
package and follows the repository pattern to provide a clean and maintainable way to handle GraphQL operations in your Flutter applications.
Contributing
Feel free to contribute to this project by:
- Forking the repository
- Creating a new branch
- Making your changes
- Submitting a pull request
Issues and Feedback
Please file issues and feature requests on the GitHub repository.
License
This project is licensed under the MIT License - see the LICENSE file for details.
Libraries
- client.config
- enums/enums
- enums/operation
- exceptions/exceptions
- exceptions/server_response_exception
- graphql_client_repository
- helpers/helpers
- helpers/query_builder_helper
- helpers/query_converter_helper
- helpers/result_parser
- interceptors/interceptors
- interceptors/result_interceptor
- models/ids/base_id
- models/ids/ids
- models/ids/integer_id
- models/ids/text_id
- models/ids/uuid_id
- models/models
- models/paginated_list_model
- models/query_filter_model
- models/search_options_model
- repository/repository
- repository/resolvers/hasura_action.resolver
- repository/resolvers/resolvers
- repository/resolvers/table_data.resolver