INNER CODE UNIT · Dart
DisplayMessage
antz22/ultimate-guide-to-flutter · code/flutter_examples.dart:170
class DisplayMessage extends StatelessWidget {
// add it to the constructor here after the key, as 'required this.<parameter>'
DisplayMessage({ Key? key, required this.message }) : super(key: key);
// initialize it as a 'final' variable (it won't change)
final String message
@override
Widget build(BuildContext context) {
return Container(
child: Text(message),
);
}
}
// what instantiating the above stateless widget class would look like
Scaffold(