I was learning flutter and came across stateful widget. Frankly, when I first faced stateful widget, that was quite confusing for me. So, here is the code:
class MyHomePage extends StatefulWidget {
@override
_MyHomePageState createState() => _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage> {
@override
Widget build(BuildContext context) {
return Container();
}
The question is Is it true that when we, say, call setState in _MyHomePageState
build function is called and THEN createState() is called which then calls _MyHomePageState()
? So, again every time setState() is called, the following things will happen build() is invoked then createState() which then calls _MyHomePageState()
.Is that true?