updateState abstract method

  1. @override
void updateState(
  1. U? value
)
override

Called on the client when a new state value is available, either when the state is first initialized, or when the state becomes available through lazy loading a route.

On initialization, this will be called as part of the super.initState() call. It is recommended to start with the inherited method call in you custom initState() implementation, however when you want to do some work before the initial updateState() call, you can invoke the super.initState() later in your implementation.

@override
void initState() {
  // do some pre-initialization
  super.initState(); // this will also call your updateState() implementation
  // do some post-initialization
}

The framework won't call setState() for you, so you have to call it yourself if you want to rebuild the component. That allows for custom update logic and reduces unnecessary builds.

Implementation

@override
void updateState(U? value);