unsubscribe method

void unsubscribe(
  1. RouteAware routeAware
)

Unsubscribe routeAware.

routeAware is no longer informed about changes to its route. If the given argument was subscribed to multiple types, this will unregister it (once) from each type.

Implementation

void unsubscribe(RouteAware routeAware) {
  final List<R> routes = _listeners.keys.toList();
  for (final R route in routes) {
    final Set<RouteAware>? subscribers = _listeners[route];
    if (subscribers != null) {
      subscribers.remove(routeAware);
      if (subscribers.isEmpty) {
        _listeners.remove(route);
      }
    }
  }
}