createState method

  1. @override
_Selector0State<T> createState()

Creates the mutable state for this component at a given location in the tree.

Subclasses should override this method to return a newly created instance of their associated State subclass:

@override
State<MyComponent> createState() => _MyComponentState();

The framework can call this method multiple times over the lifetime of a StatefulComponent. For example, if the component is inserted into the tree in multiple locations, the framework will create a separate State object for each location. Similarly, if the component is removed from the tree and later inserted into the tree again, the framework will call createState again to create a fresh State object, simplifying the lifecycle of State objects.

Implementation

@override
_Selector0State<T> createState() => _Selector0State<T>();