graphql_client_repository 1.0.1
graphql_client_repository: ^1.0.1 copied to clipboard
A Flutter package that provides a wrapper for GraphQL client to be used in repositories, simplifying GraphQL integration in Flutter applications.
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.