setDiscoveredRouteName method

void setDiscoveredRouteName(
  1. String? routeName
)

Synchronizes a route discovered from the current widget tree.

Implementation

void setDiscoveredRouteName(String? routeName) {
  if (_isDisposed) {
    return;
  }
  final normalizedRouteName = _normalizeObservedRouteName(routeName);
  if (normalizedRouteName == currentRouteName.value) {
    return;
  }
  _discoveredRouteName = normalizedRouteName;
  // Discovery runs as part of a live target read. Apply this observation
  // synchronously so an expected-route wait can consume it in the same loop.
  _applyRouteName(normalizedRouteName);
}