Google News
logo
Flutter - Interview Questions
What is StatefulWidget LifeCycle?
The lifecycle has the following simplified steps :

createState() : When we build a new StatefulWidget, this one calls createState() right away and this override method must exist.

initState() : It is the first method called after the Widget is created.This is our equivalent to onCreate() and viewDidLoad()

didChangeDependencies() : This method is called immediately after initState() on the first time the widget is built.

build() : This is called right after didChangeDependencies(). All the GUI is rendered here and will be called every single time the UI needs to be rendered.

didUpdateWidget() : It’ll be called once the parent Widget did a change and needs to redraw the UI.

deactivate() : Framework calls this method whenever it removes this State object from the tree

dispose() : It is called when this object and its State are removed from the tree permanently and will never build again.
Advertisement