Types of Widgets

There are broadly two types of widgets in the flutter: 

  • Stateless Widget
  • Stateful Widget

1. Stateless Widget

Stateless Widget is a type of widget which once built , then it’s properties and state can’t be changed. These widgets are immutable, once created can’t be modified.

Note: These are used for static content or UI content that don’t need a change after time.

Key Characterstics of Stateless Widgets are: Immutable , No State and Lightweight.

Examples: Display Text , Icons, Images, etc.

2. Stateful Widget

Stateful Widgets is a type of widget that can change state. It can maintain and update the appearance in the response to change in state.

Note: These are used for dynamic change in the properties and appearance over the time.

Key Characterstics of Stateful Widgets are: Mutable State , State Lifecycle and Dynamic Updates.

Examples: Buttons, Sliders, Text Fields, etc.

What is Widgets in Flutter?

Flutter is Google’s UI toolkit for crafting beautiful, natively compiled iOS and Android apps from a single code base. To build any application we start with widgets – The building block of Flutter applications. Widgets describe what their view should look like given their current configuration and state. It includes a text widget, row widget, column widget, container widget, and many more. 

Similar Reads

What are Widgets?

Each element on the screen of the Flutter app is a widget. The view of the screen completely depends upon the choice and sequence of the widgets used to build the apps. And the structure of the code of apps is a tree of widgets....

Category of Widgets

There are mainly 14 categories into which the flutter widgets are divided. They are mainly segregated on the basis of the functionality they provide in a flutter application....

Types of Widgets

There are broadly two types of widgets in the flutter:...

Implementation of Stateful and Stateless Widgets

Below is the Image with showing the Layout Tree:...