Why are StatefulWidget and state separate classes flutter?

There are multiple reasons : Widgets are immutable . Since StatefulWidget extends Widget it therefore must be immutable too. Splitting the declaration into two classes allows both StatefulWidget to be immutable and State to be mutable.

Leave a Reply

Your email address will not be published. Required fields are marked *