subscribe method

void subscribe(
  1. RouteAware routeAware,
  2. R route
)

Subscribe routeAware to be informed about changes to route.

Going forward, routeAware will be informed about qualifying changes to route, e.g. when route is covered by another route or when route is popped off the Navigator stack.

Implementation

void subscribe(RouteAware routeAware, R route) {
  final Set<RouteAware> subscribers = _listeners.putIfAbsent(route, () => <RouteAware>{});
  if (subscribers.add(routeAware)) {
    routeAware.didPush();
  }
}