selectElementByType<T extends PCanvasElement> method
Returns a list of PCanvasElement of type T
.
Implementation
List<T> selectElementByType<T extends PCanvasElement>(
{bool recursive = false}) {
var elements = this.elements;
var sel = elements.whereType<T>().toList();
if (!recursive) {
return sel;
}
var subList = elements
.whereType<PCanvasElementContainer>()
.expand((e) => e.selectElementByType<T>(recursive: true))
.toList();
return [...sel, ...subList];
}