Big appreciation to #ralph_nee for expanding his collection with 6 #NFTs 🙌🔥 Always great to see the journey continue! #eCash $XEC #NFTCommunity #NFTCollectors #NFTartist #NFTUniverse #CryptoMarket pic.twitter.com/6ZVVogEmj9
— NFToa (@nftoa_) October 1, 2025
I have two screens in my Flutter app: a list of records and a screen for creating and editing records.
If I pass an object to the second screen, it means I am editing it, and if I pass null, it means I am creating a new item. The editing screen is a Stateful widget, and I'm not sure how to use the approach described in this Flutter cookbook guide for my case.
class RecordPage extends StatefulWidget {
final Record recordObject;
RecordPage({Key key, @required this.recordObject}) : super(key: key);
@override
_RecordPageState createState() => new _RecordPageState();
}
class _RecordPageState extends State<RecordPage> {
@override
Widget build(BuildContext context) {
//.....
}
}
Question
How can I access recordObject within _RecordPageState?
Solution
To use recordObject in _RecordPageState, you simply reference it using widget.objectName as shown below.
class _RecordPageState extends State<RecordPage> {
@override
Widget build(BuildContext context) {
.....
widget.recordObject
.....
}
}