onPush method
This method is invoked when the route is pushed on top of the RouterComponent's stack.
The argument for this method is the route that was on top of the stack before the push. It can be null if the current route becomes the first element of the navigation stack.
Implementation
@mustCallSuper
@override
void onPush(Route? previousRoute) {
assert(
camera != null || game is FlameGame,
'You need to either provide a camera or use a FlameGame to use the '
'WorldRoute',
);
if (camera != null) {
_previousWorld = camera?.world;
camera?.world = build();
} else {
_previousWorld = (game as FlameGame).world;
(game as FlameGame).world = build();
}
}