effects top-level property

EffectsMethods get effects

Methods to access the stack of effects. This returns an immutable copy of the stack, a push method and a pull method.

Implementation

EffectsMethods get effects {
  void pull() => (_effects.isNotEmpty) ? _effects.removeLast() : null;
  void push(Effect effect) {
    for (final filter in filters) {
      if (filter(effect)) return;
    }

    _effects.add(effect);
  }

  return (
    List.unmodifiable(_effects),
    push: push,
    pull: pull,
  );
}