unsubscribe method

void unsubscribe(
  1. MyRouteAware 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(MyRouteAware routeAware) {
  final List<R> routes = _listeners.keys.toList();
  for (final R route in routes) {
    final Set<MyRouteAware>? subscribers = _listeners[route];
    if (subscribers != null) {
      subscribers.remove(routeAware);
      if (subscribers.isEmpty) {
        _listeners.remove(route);
      }
    }
  }
}