go method

Future<void> go(
  1. RouteNode route, {
  2. Transition? transition,
})

Replaces the whole stack with route, playing transition over the route's own and the default, and completes once the navigation settles.

A navigation already running is settled first. Every push dropped completes with null.

Implementation

Future<void> go(
  RouteNode route, {
  Transition? transition,
}) {
  _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.');

  return _launch(
    _Swap(
      transition ?? route.transition ?? this.transition,
      incoming: route,
      outgoing: top,
    ),
  );
}