Stateless Widgets
Pure UI built from properties
A StatelessWidget is pure UI with no mutable state. It takes data in, renders once, and never changes on its own.
Greeting
name: 'Alice'final
style: boldfinal
All fields are final. No internal mutation.
Dart
class Greeting extends StatelessWidget {
final String name; // immutable
const Greeting({required this.name});
@override
Widget build(BuildContext context) {
return Text('Hello, $name');
}
}