findSelfAndAncestorWidgets method
Returns a list of NestedScrollConnection widgets including self and all ancestor widgets up the tree.
Implementation
List<NestedScrollConnection> findSelfAndAncestorWidgets() {
final List<NestedScrollConnection> widgets = [widget];
context.visitAncestorElements((element) {
if (element.widget is NestedScrollConnection) {
widgets.add(element.widget as NestedScrollConnection);
}
return true;
});
return widgets;
}