Stateless vs Stateful Widget

What is State?

a state is a information display on ui screen, example a text counter in a center of screen in flutter starting app, the count text is shows the information about counter.

Stateless widget?

a stateless widget is a ui which once initialized and never be changed, stateless class have build method to display which information to be drawn, it is very useful for displaying static contents.

Stateful widget?

a stateful widget is same as stateless widget, a stateful widget have two classes a state class is responsible for update the ui changes, a count text that shows information about counter can be changed in state class using setState() method, this method is rebuild the ui. basically a state class have life cycle methods for drawing, updating, and disposing the state.

Leave a comment

Design a site like this with WordPress.com
Get started