On the other hand, Stateless widget is a widget whose state is immutable, thus you can not change the widget appearance dynamically in any way. So, they are used when we have static widget.

State types.

Now if we make a Stateful widget, its state is only available to the widget itself. however, sometimes it is essential to have a common state between different widgets so that different widgets can use the same state data at the same time.

Let’s consider a short scenario. Say, if we are making cart application in which user can select products from the application and add it to cart, and once He completes his shopping, he can navigate to the Checkout screen so that he can know and pay the bill.