DataLoader<K extends Object, V, C> constructor
DataLoader<K extends Object, V, C> (
- BatchLoadFn<
K, V> _batchLoadFn, [ - DataLoaderOptions<
K, V, C> ? options
Main DataLoader constructor
use DataLoader.unmapped if the
item key K
is equal to the cache key C
Implementation
DataLoader(this._batchLoadFn, [DataLoaderOptions<K, V, C>? options])
: _maxBatchSize = _getValidMaxBatchSize(options),
_batchScheduleFn = _getValidBatchScheduleFn(options),
_cacheKeyFn = options?.cacheKeyFn ??
(K == C
? (k) => k as C
: throw ArgumentError(
'Must pass options.cacheKeyFn if the'
' key type K $K is different from C $C.',
)),
_cacheMap = _getValidCacheMap(options);