For one-time initialization of state of stateful widget, we should use initState() instead of class constructor.
The framework calls initState. Subclasses of State should override initState to perform one-time initialization that depends on the BuildContext or the widget, which are available as the context and widget properties, respectively, when the initState method is called.
For one-time initialization of state of stateful widget, we should use initState() instead of class constructor.
Reference: State
Instead of passing variables from the stateful widget to its state, we should use
widget.A
to access that variable.