I have seen in various files about init method under some classes, why we use this method and please also describe other useful methods if you know, Thanks
I have initialized this method but it didn’t work properly.
I have seen in various files about init method under some classes, why we use this method and please also describe other useful methods if you know, Thanks
I have initialized this method but it didn’t work properly.
2
Answers
The @initState method is called by Flutter when a widget is inserted into the tree. It’s important to note that the initState method is only called once, when the widget is inserted into the tree, and not every time the widget is updated. If you need to perform an operation every time the widget is updated, you can use the didUpdateWidget method instead.
dispose, build, setState, build and much more method are interesting in Flutter, you can try to understand what each method do in this amazing "cookbook" in flutter documentation.
https://docs.flutter.dev/cookbook
To understand the methods and structure of flutter widgets, you need to understand the lifecycle of flutter screen or flutter application.
So, basically flutter’s stateful widgets have really good methods which are
You can learn more about this on medium