getOrNull<N extends Node> method
Looks up a node by type compatibility (supports interfaces).
Implementation
N? getOrNull<N extends Node>({Key? key}) {
if (key != null) {
final exact = getByKey(key);
if (exact is N) return exact;
return null;
}
// Exact match first
final exact = _nodes[Key(N.toString())];
if (exact is N) return exact;
// Subtype match (e.g. find ProductsNode via CatalogueControllerInterface)
for (final node in _nodes.values) {
if (node is N) return node;
}
return null;
}