query<C extends T> method

List<C> query<C extends T>()

Allow you to find a subset of this set with all the elements e for which the condition e is C is true. This is equivalent to

  orderedSet.whereType<C>()

except that it is O(0).

Note: you must call register for every type C you desire to use before calling this.

Implementation

List<C> query<C extends T>() {
  final result = _cache[C];
  if (result == null) {
    throw 'Cannot query unregistered query $C';
  }
  return result.data as List<C>;
}