End video as new route opens flutter

In Flutter, you can use the Navigator class to push a new route onto the navigator's stack, which will replace the current route. Here's an example:

Navigator.pushReplacement(
  context,
  MaterialPageRoute(builder: (context) => NewRoute()),
);

This will replace the current route with the NewRoute widget.

If you want to pop the current route and push a new one, you can use Navigator.push instead:

Navigator.push(
  context,
  MaterialPageRoute(builder: (context) => NewRoute()),
);

This will push the NewRoute widget onto the navigator's stack, but the current route will still be visible.

If you want to pop all routes and push a new one, you can use Navigator.pushAndRemoveUntil:

Navigator.pushAndRemoveUntil(
  context,
  MaterialPageRoute(builder: (context) => NewRoute()),
  (Route<dynamic> route) => false,
);

This will push the NewRoute widget onto the navigator's stack and remove all previous routes.

Note that in all cases, you need to provide the context of the widget that is currently being displayed.