findAncestor static method

AudioEngine? findAncestor(
  1. Node node
)

Returns the nearest AudioEngine on node or an ancestor, or null.

Implementation

static AudioEngine? findAncestor(Node node) {
  for (Node? current = node; current != null; current = current.parent) {
    final engine = current.getComponent<AudioEngine>();
    if (engine != null) return engine;
  }
  return null;
}