didPop method

  1. @override
  2. @mustCallSuper
void didPop()
inherited

Called when this route has been popped off.

Implementation

@override
@mustCallSuper
void didPop() {
  // Don't if the State object is defunct.
  if (!mounted) {
    return;
  }

  // No 'setState()' functions are allowed
 //   _setStateAllowed = false;

  for (final con in controllerList) {
    con.didPop();
  }

  _setStateAllowed = true;

  if (_setStateRequested) {
    _setStateRequested = false;
    // Only the latest State is rebuilt
    if (isLastState) {
      // Perform a 'rebuild' if requested.
      setState(() {});
    }
  }

  // Record the triggered event
  assert(() {
    if (_printEvents) {
      debugPrint('============ Event: didPop() in $this');
    }
    return true;
  }());
}