gql_cache_lens 0.3.0+1
gql_cache_lens: ^0.3.0+1 copied to clipboard
A Flutter DevTools Extension for inspecting GraphQL cache.
gql_cache_lens #
A Flutter DevTools Extension for inspecting GraphQL cache
Features #
- View the entire GraphQL cache
- Inspect individual cache entries
Supported GraphQL Packages #
Currently, gql_cache_lens supports the following GraphQL packages:
Screenshots #
[] []
Installation #
To install gql_cache_lens, add the package to your pubspec.yaml file:
dev_dependencies:
gql_cache_lens: ^0.3.0
Alternatively, you can run the following command
flutter pub add --dev gql_cache_lens
Usage #
To use gql_cache_lens, add a ServiceExtensionHandler as shown below.
Return a JSON-encoded Map obtained from the Store's toMap() method in the ServiceExtensionResponse's result.
final GrpahQLClient client = ...;
registerExtension('ext.gql_cache_lens.load', (_, __) async {
final cacheMap = client.cache.store.toMap();
final cacheJson = jsonEncode(cacheMap);
return ServiceExtensionResponse.result(cacheJson);
});
Contributing #
Contributions are welcome! If you find a bug or have a feature request, please open an issue.
License #
This project is licensed under the MIT License. See the LICENSE file for details.