I sometimes see stateful widget with the state which doesn't have any state fields. What is the reason of using such stateful widget? Is not better in that case to convert that stateful widget into stateless widget?
I sometimes see stateful widget with the state which doesn't have any state fields. What is the reason of using such stateful widget? Is not better in that case to convert that stateful widget into stateless widget?
State objects (created by StatefulWidget) have their own lifecycle. They can override initState, didChangeDependencies, didUpdateWidget, dispose, etc to perform some tasks at specific cases. See lifecycle description in State class docs