transitiveSupertypeNames static method

List<String> transitiveSupertypeNames(
  1. String className
)

Walk the registered supertype chain (transitively) starting from className and return the full set of ancestor class names in breadth-first order. Used by interface-proxy resolution so an interpreted class like PanelTheme extends InheritedTheme can still match a proxy factory registered for InheritedWidget up the chain. Excludes className itself.

Implementation

static List<String> transitiveSupertypeNames(String className) {
  final seen = <String>{};
  final order = <String>[];
  final queue = <String>[];
  final direct = _supertypeRegistry[className];
  if (direct != null) queue.addAll(direct);
  while (queue.isNotEmpty) {
    final next = queue.removeAt(0);
    if (!seen.add(next)) continue;
    order.add(next);
    final step = _supertypeRegistry[next];
    if (step != null) queue.addAll(step);
  }
  return order;
}