register<C extends E> method

void register<C extends E>()

Adds a new cache for a subtype C of E, 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 E>() {
  if (isRegistered<C>()) {
    return;
  }
  _cache[C] = _CacheEntry<C, E>(
    data: _filter<C>(),
  );
}