Flutter different between Stateful and Stateless Widget

Flutter Provides 2 types of Class Stateful Widget and Stateless Widget. Every class must extends these of the Class.

Stateless Widget

  • Stateless widgets cannot change their state during the runtime of the app, which means the widgets cannot be redrawn while the app is in action.
  • Structure of the Stateless widget are look like this

Stateless widget only have build method and that build method call only once when load this screen. it doesn’t have initState method.

Stateful Widget

  • Stateful widget can change their state multiple times and can be redrawn on to the screen any number of times while the app is in action.
  • It look likes this one

It has build as well as initState method. we can also use setState method to reload all widgets under stateful widgets.

Visit Flutter Official Website : flutter.dev


You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *