push<R> method
- RouteNode route
Lays route over the top, playing the route's own transition over the
default and leaving the route beneath to its backdrop.
A push takes no transition of its own, because the matching pop has to play the same one back, and the route is where that is kept.
Completes with what the pop carries, or null when a later navigation drops the push.
Implementation
Future<R?> push<R>(RouteNode route) {
_settle();
// Checked after settling, since that is what takes the departing route
// off the stack and so makes room to go back to it.
assert(!routes.contains(route), 'That route is already on the stack.');
_launch(
_Layer(
route.transition ?? transition,
incoming: route,
covered: top,
backdrop: route.backdrop,
),
);
// Set once launched, since settling a pop of this same route clears it.
final completer = Completer<R?>();
route._completer = completer;
return completer.future;
}