onPop method

  1. @mustCallSuper
  2. @override
void onPop(
  1. Route nextRoute
)
override

This method is called when the route is popped off the top of the RouterComponent's stack.

The argument for this method is the route that will become the next top-most route on the stack. Thus, the argument in onPop will always be the same as was given previously in onPush.

Implementation

@mustCallSuper
@override
void onPop(Route nextRoute) {
  if (camera != null) {
    camera?.world = _previousWorld;
  } else {
    (game as FlameGame).world = _previousWorld ?? World();
  }
}