didReplace method

  1. @override
void didReplace(
  1. Route? oldRoute
)
override

Called after install when the route replaced another in the navigator.

The didChangeNext and didChangePrevious methods are typically called immediately after this method is called.

Implementation

@override
void didReplace(Route<dynamic>? oldRoute) {
  assert(_controller != null,
      '$runtimeType.didReplace called before calling install() or after calling dispose().');
  assert(!_transitionCompleter.isCompleted,
      'Cannot reuse a $runtimeType after disposing it.');
  if (oldRoute is ToastMessageBarRoute) {
    _controller!.value = oldRoute._controller!.value;
  }
  _animation!.addStatusListener(_handleStatusChanged);
  super.didReplace(oldRoute);
}