Flutter Widget lifecycle in Sequence

createState():

This method is called when a StatefulWidget is created. It returns an instance of the State class associated with the widget.

initState():

This method is called once, after the State object has been created. It is used to initialize the state of the widget, such as setting up variables or making network requests.

didChangeDependencies():

This method is called whenever the dependencies of the State object change. For example, if a StatefulWidget depends on a InheritedWidget, this method will be called whenever the InheritedWidget changes.

build():

This method is called whenever the widget needs to be rebuilt. This can happen for a variety of reasons, such as when the state of the widget changes, when the parent widget changes, or when the device orientation changes.

didUpdateWidget():

This method is called whenever the StatefulWidget is updated with a new instance of itself. This can happen if the widget' s properties are changed, or if the widget is replaced with a new widget of the same type.

setState():

This method is used to update the state of the widget. When this method is called, the widget will be rebuilt.

deactivate():

This method is called when the widget is no longer visible on the screen.

dispose():

This method is called when the widget is destroyed. It is used to clean up any resources that the widget may be using.