didReplace method Null safety

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

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.


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 TransitionRoute) {
    _controller!.value = oldRoute._controller!.value;