Stateless : Widget state creates ONLY ONCE, then it can update values but not state explicitly. That’s why it has only one class which extends with StatelessWidget
. They can never re-run build()
method again.
Stateful : Widgets can update their STATE (locally) & values multiple times upon event triggered. That’s the reason, the implementation is also different. In this, we have 2 classes, one is StatefulWidget
& the other is it’s State implementation handler i.e. State<YourWidget>
. So if I say, they can re-run build()
method again & again based on events triggered.
- A
StatelessWidget
will never rebuild by itself (but can from external events). AStatefulWidget
can. - A
StatelessWidget
is static wheres aStatefulWidget
is dynamic.