didUpdateWidget method
Override this method to respond when its StatefulWidget is re-created.
The framework always calls build
after calling didUpdateWidget
, which
means any calls to setState
in didUpdateWidget
are redundant.
Implementation
@override
@mustCallSuper
void didUpdateWidget(covariant T oldWidget) {
/// No 'setState()' functions are allowed
_setStateAllowed = false;
for (final con in controllerList) {
con.didUpdateWidget(oldWidget);
}
super.didUpdateWidget(oldWidget);
/// Re-enable setState() function
_setStateAllowed = true;
/// No 'setState()' functions are necessary
_setStateRequested = false;
// Record the triggered event
assert(() {
if (_printEvents) {
debugPrint('============ Event: didUpdateWidget() in $this');
}
return true;
}());
}