How widgets are different from UI components?

Viewed 315

I read everywhere on internet, in flutter everything is a widget but what actually widget is.I thinks its simply contain a bunch of properties that flutter need to render something on screen.
But If widget is same as UI component then why we specially called it (Widget),like other languages we simply called UI components.
Is Widgets same as UI component?

1 Answers

A widget is just a class that extends either the StatefulWidget or StatelessWidget classes.

It is also not really true that everything in flutter is a widget, but a lot of things are widgets. There are a hierarchy of widgets from the whole app itself to the containers or texts you have on the page, and everything in between. Lots of code you write for your app might be outside of these widget classes, and just interact with them.

Related