deduplicate<T> static method

Future<T> deduplicate<T>(
  1. List key,
  2. Future<T> fetcher()
)

Deduplicates concurrent asynchronous requests sharing the same cache key.

Scoped to currentScope: identical keys in concurrent SSR requests execute independently and never share in-flight work.

final result = await BloomData.deduplicate(['items'], () => client.get('/items'));

Implementation

static Future<T> deduplicate<T>(
        List<dynamic> key, Future<T> Function() fetcher) =>
    currentScope.deduplicate<T>(key, fetcher);