pushReplacement<T, TO> method

Future<T?> pushReplacement<T, TO>(
  1. Route<T> route, {
  2. TO? result,
})

Pushes a route and removes the current top route.

The result is used to complete the previous route's future.

Implementation

Future<T?> pushReplacement<T, TO>(Route<T> route, {TO? result}) {
  // Pop the current route first (without triggering rebuild yet).
  if (_routes.isNotEmpty) {
    _removeTopRoute(result: result);
  }
  return push<T>(route);
}