didRemove method
The Navigator removed route.
If only one route is being removed, then the route immediately below
that one, if any, is previousRoute.
If multiple routes are being removed, then the route below the
bottommost route being removed, if any, is previousRoute, and this
method will be called once for each removed route, from the topmost route
to the bottommost route.
Implementation
@override
void didRemove(Route<dynamic> route, Route<dynamic>? previousRoute) {
super.didRemove(route, previousRoute);
// Notify listener of route change
onRouteChanged?.call(previousRoute, route);
// Only log if route logging is enabled AND log level permits
if (ZenConfig.shouldLogRoutes) {
final routeName = route.settings.name ?? 'unnamed';
ZenLogger.logInfo('Route removed: $routeName');
}
// Dispose controllers associated with the removed route
_disposeControllersForRoute(route);
}