DoLastWith<C extends Comp<T>> method

void DoLastWith<C extends Comp<T>>(
  1. void fn(
    1. E entity,
    2. C c
    )
)

Query-like Calls fn with the last matching element and its C component. Does nothing if the result set is empty.

Implementation

void DoLastWith<
  C extends Comp<T>
>(void Function(E entity, C c) fn) {
  final entities = _resolve();
  if (entities.isEmpty) return;
  final entity = entities.last;
  entity.on<C>((c) => fn(entity, c));
}