didAdd method

  1. @protected
  2. @mustCallSuper
void didAdd ()
@mustCallSuper, @protected

Called after install when the route is added to the navigator.

This method is called instead of didPush when the route immediately appears on screen without any push transition.

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


void didAdd() {
  // This TickerFuture serves two purposes. First, we want to make sure
  // animations triggered by other operations finish before focusing the
  // navigator. Second, navigator.focusScopeNode might acquire more focused
  // children in Route.install asynchronously. This TickerFuture will wait for
  // it to finish first.
  // The later case can be found when subclasses manage their own focus scopes.
  // For example, ModalRoute create a focus scope in its overlay entries. The
  // focused child can only be attached to navigator after initState which
  // will be guarded by the asynchronous gap.
  TickerFuture.complete().then<void>((void _) {