hii我是新的Flutter和面临以下错误
final String title;
final String desc;
final String timer;
const ListElement({Key? key, required this.title, required this.desc ,required this.timer}) :
super(key: key);
这是我的构造函数,我在其中传递了title desc和timer
Text(title, style: TextStyle(fontWeight: FontWeight.w400 ,
fontSize: 30),),
Text(desc, style: TextStyle(fontWeight: FontWeight.w400 ,
fontSize: 15),),
获取标题和说明时遇到此错误
2条答案
按热度按时间ni65a41a1#
如果小部件是
stateful
,则必须将title
写为xxslljrj2#
确定,我使用“${widget.title}”来解决此问题