push<T> method

Future<T?> push<T>(
  1. Route route
)

Pushes the given route onto the navigator stack.

Returns a future that completes with the pop result when the route is popped.

Implementation

Future<T?> push<T>(Route route) {
  final completer = Completer<T?>();
  final previousRoute = currentRoute;
  setState(() {
    _addRoute(route, completer);
  });
  if (route.fullScreenRender) {
    WidgetsBinding.instance.scheduleFrameWithClear();
  } else {
    WidgetsBinding.instance.scheduleFrame();
  }
  _notifyObservers((observer) => observer.didPush(route, previousRoute));
  return completer.future;
}