portByPathname method

SignalOccurrence? portByPathname(
  1. String pathname
)

Resolves a port by its absolute hierarchy path without inspecting internal signals.

Implementation

SignalOccurrence? portByPathname(String pathname) {
  final parts = pathname
      .replaceAll('.', hierarchyPathSeparator)
      .split(hierarchyPathSeparator);
  if (parts.length < 2 || parts.any((part) => part.isEmpty)) {
    return null;
  }
  final portName = parts.removeLast();
  final owner = occurrenceByPathname(parts.join(hierarchyPathSeparator));
  return owner?.portByName(portName);
}