didUpdateWidget method

  1. @protected
void didUpdateWidget(
  1. T oldWidget
)

Called whenever the widget configuration changes.

If the parent widget rebuilds and request that this location in the tree update to display a new widget with the same runtimeType, the framework will update the widget property of this State object to refer to the new widget and then call this method with the previous widget as an argument.

Override this method to respond when the widget changes (e.g., to start implicit animations).

The framework always calls build after calling didUpdateWidget, which means any calls to setState in didUpdateWidget are redundant.

Implementation

@protected
void didUpdateWidget(T oldWidget) {}