subscribe method

void subscribe (RouteAware routeAware, 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) {
  assert(routeAware != null);
  assert(route != null);
  final Set<RouteAware> subscribers = _listeners.putIfAbsent(route, () => Set<RouteAware>());
  if (subscribers.add(routeAware)) {
    routeAware.didPush();
  }
}