didRemove method

  1. @override
void didRemove(
  1. Route route,
  2. Route? previousRoute
)
override

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 route, Route? previousRoute) {
  DSMetrica._screenNames.remove(route.settings.name);
  final name = DSMetrica._screenNames.isNotEmpty
      ? DSMetrica._screenNames.last
      : '/';
  DSMetrica.reportScreenOpened(name);
  super.didRemove(route, previousRoute);
}