I just need some idea on how flutter stateful widgets build their stateful children when setState() is invoked. Please look at the code below.
When you use setState(()) only the build() will get called. Now in this method you are again invoking StatefulChild() (first line) which further instantiates this class so the build() method of this class gets executed.
But when you use statefulChild it is not creating a new instance because
StatefulChild statefulChild = StatefulChild();
is used outside the build() method. So it just got called once.