DataLoader<Id, Data> class

A utility for batching multiple requests together, to improve application performance.

Enqueues batches of requests until the next tick, when they are processed in bulk.

Port of Facebook's DataLoader: https://github.com/graphql/dataloader

Constructors

DataLoader(FutureOr<Iterable<Data>> loadMany(Iterable<Id>), {bool cache = true})

Properties

cache bool
Whether to use a memoization cache to store the results of past lookups.
final
hashCode int
The hash code for this object.
no setterinherited
loadMany FutureOr<Iterable<Data>> Function(Iterable<Id>)
Invoked to fetch a batch of keys simultaneously.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

clear(Id key) → void
Clears the value at key, if it exists.
clearAll() → void
Clears the entire cache.
close() → void
Closes this DataLoader, cancelling all pending requests.
load(Id id) Future<Data>
Returns a Future that completes when the next batch of requests completes.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
prime(Id key, Data value) → void
Primes the cache with the provided key and value. If the key already exists, no change is made.
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited