flutter pass parameter to statefulwidget
class _RecordPageState extends State<RecordPage> {
@override
Widget build(BuildContext context) {
.....
widget.recordObject
.....
}
}
flutter pass parameter to statefulwidget
class _RecordPageState extends State<RecordPage> {
@override
Widget build(BuildContext context) {
.....
widget.recordObject
.....
}
}
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")
);
}
}
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us