Answers for "flutter pass parameter to statefulwidget"

0

flutter pass parameter to statefulwidget

class _RecordPageState extends State<RecordPage> {
  @override
  Widget build(BuildContext context) {
   .....
   widget.recordObject
   .....
  }
}
Posted by: Guest on January-05-2021
-1

flutter constructor in statefull widget

STATEFUL WIDGET CONSTRUCTOR

class ServerIpText extends StatefulWidget {
  final String serverIP;

  const ServerIpText ({ Key key, this.serverIP }): super(key: key);

  @override
  _ServerIpTextState createState() => _ServerIpTextState();
}

class _ServerIpTextState extends State<ServerIpText> {
  @override
  Widget build(BuildContext context) {
    return Text(widget.serverIP);
  }
}

class AnotherClass extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Center(
      child: ServerIpText(serverIP: "127.0.0.1")
    );
  }
}
Posted by: Guest on August-10-2020

Code answers related to "flutter pass parameter to statefulwidget"

Browse Popular Code Answers by Language