- override
Change the widget used to configure this element.
The framework calls this function when the parent wishes to use a
different widget to configure this element. The new widget is guaranteed
to have the same runtimeType
as the old widget.
This function is called only during the "active" lifecycle state.
Source
@override void update(StatefulWidget newWidget) { super.update(newWidget); assert(widget == newWidget); StatefulWidget oldConfig = _state._config; // Notice that we mark ourselves as dirty before calling didUpdateConfig to // let authors call setState from within didUpdateConfig without triggering // asserts. _dirty = true; _state._config = widget; try { _debugSetAllowIgnoredCallsToMarkNeedsBuild(true); _state.didUpdateConfig(oldConfig); } finally { _debugSetAllowIgnoredCallsToMarkNeedsBuild(false); } rebuild(); }