This might be an odd question but I'm wondering what's the actual use of stateless widget if one can simply return a widget? Stateful widgets on the other hand are useful for handling states because of setState method. Are stateless widget only useful because of access to BuildContext variable?
void main() {
runApp(MaterialApp(
title: "Direct",
home: Scaffold(
appBar: AppBar(
title: Text("TITLE"),
),
body: Container(
child: Text("TITLE"),
),
),
));
}
The above code works and shows the basic AppBar and Body without using a stateless widget.