propagateToChildren<T extends Component> method

bool propagateToChildren<T extends Component>(
  1. bool handler(
    1. T
    ), {
  2. bool includeSelf = false,
})
inherited

This method first calls the passed handler on the leaves in the tree, the children without any children of their own. Then it continues through all other children. The propagation continues until the handler returns false, which means "do not continue", or when the handler has been called with all children.

This method is important to be used by the engine to propagate actions like rendering, taps, etc, but you can call it yourself if you need to apply an action to the whole component chain. It will only consider components of type T in the hierarchy, so use T = Component to target everything.

Implementation

bool propagateToChildren<T extends Component>(
  bool Function(T) handler, {
  bool includeSelf = false,
}) {
  return descendants(reversed: true, includeSelf: includeSelf)
      .whereType<T>()
      .every(handler);
}