pass parameter to stateful widget flutter code example

Example 1: flutter stateful widget

class YellowBird extends StatefulWidget {
  const YellowBird({ Key key }) : super(key: key);

  
  _YellowBirdState createState() => _YellowBirdState();
}

class _YellowBirdState extends State<YellowBird> {
  
  Widget build(BuildContext context) {
    return Container(color: const Color(0xFFFFE306));
  }
}

Example 2: flutter pass parameter to statefulwidget

class _RecordPageState extends State<RecordPage> {
  
  Widget build(BuildContext context) {
   .....
   widget.recordObject
   .....
  }
}

Tags:

Dart Example