didChangeNext method

  1. @override
void didChangeNext(
  1. Route? nextRoute
)
override

This route's next route has changed to the given new route.

This is called on a route whenever the next route changes for any reason, so long as it is in the history, including when a route is first added to a Navigator (e.g. by Navigator.push), except for cases when didPopNext would be called.

The nextRoute argument will be null if there's no new next route (i.e. if isCurrent is true).

Implementation

@override
void didChangeNext(Route<dynamic>? nextRoute) {
  final next = isActive ? nextRoute : null;
  _next = next is CardRouteMixin ? next : null;
  _nextOverdrag?.removeListener(_copyOverdrag);
  _nextOverdrag = switch (next) {
    final DragBackRouteMixin<dynamic> route => route.dragBackOverdrag,
    _ => null,
  };
  _nextOverdrag?.addListener(_copyOverdrag);
  _copyOverdrag();
  if (next is CardRouteMixin) {
    _coveredByZoom.value = next.recedesCovered;
  }
  super.didChangeNext(next);
  retakeSnapshot();
}