hierarchy method

List<Component> hierarchy()

Returns a List of Components representing the full hierarchy of this Component, with the top-most parent at index 0 and this as the last element of the List.

Implementation

List<Component> hierarchy() =>
    (parent == null ? <Component>[] : parent!.hierarchy())..add(this);