Difference between Widget and Stateless widget

Issue

In the Flutter docs they say that a Widget is a mutable configuration (description) for an Element, which I have no problem understanding.
But then we have the stateless widget, which extends the Widget class, and must implement a build method. The two classes look like they do the same job, can any one explain the difference ?

Thanks.

Solution

Widget is just an interface. You’re never gonna use it directly, and this class does absolutely nothing.

It exists just for the compiler to know that your program is type-safe.

Answered By – Rémi Rousselet

Answer Checked By – Clifford M. (FlutterFixes Volunteer)

Leave a Reply

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