register<C extends T> method

void register<C extends T>()

Adds a new cache for a subtype C of T, allowing you to call query. If the cache already exists this operation is a no-op.

If the set is not empty, the current elements will be re-sorted.

It is recommended to register all desired types at the beginning of your application to avoid recomputing the existing elements upon registration.

Implementation

void register<C extends T>() {
  if (isRegistered<C>()) {
    return;
  }
  _cache[C] = _CacheEntry<C, T>(
    data: _filter<C>(),
  );
}