graphql_cache_inspector 0.0.2+1 copy "graphql_cache_inspector: ^0.0.2+1" to clipboard
graphql_cache_inspector: ^0.0.2+1 copied to clipboard

A Flutter Plugin that helps to inspect the graphql cache on device.

A Flutter Plugin that helps to inspect the graphql cache on device

Features #

  • Visualizes the GraphQL Cache Data using simple lists

Usage #

import 'grapqhl_cache_inspector.dart' into your dart code.

import 'package:grapqhl_cache_inspector/grapqhl_cache_inspector.dart';

The GraphqlCacheInspector takes in a function that gets the cache data, as well as the data itself

GraphqlCacheInspector(
 title: 'GraphQL Cache',
 data: graphql.getCacheDump(),
 getCacheData: graphql.getCacheDump,
);

You may perhaps use this as a page of its own by having a button that opens the CacheInspector, using something like

ElevatedButton(
 onPressed: () {
  Navigator.of(context).push(
   MaterialPageRoute(
    builder: ((context) {
     return GraphqlCacheInspector(
      title: 'GraphQL Cache',
      data: graphql.getCacheDump(),
      getCacheData: graphql.getCacheDump,
     );
    }),
   ),
  );
 },
 child: const Text('Get GraphQL Cache Dump'),
),

Here getCacheDump() would be a function that converts your cache into json, the exact implementation would depend on your store

For example if using Hive as your cache store we would define this as

Map<dynamic, Map<dynamic, dynamic>?> getCacheDump() {
    return hivestore.box.toMap();
}

Additional information #

This is a WIP new package, expect breaking changes.

3
likes
150
points
8
downloads

Publisher

unverified uploader

Weekly Downloads

A Flutter Plugin that helps to inspect the graphql cache on device.

Repository (GitHub)
View/report issues

Documentation

API reference

License

BSD-3-Clause (license)

Dependencies

flutter

More

Packages that depend on graphql_cache_inspector