Home > Software engineering >  Undefined name 'title'. (Documentation)
Undefined name 'title'. (Documentation)

Time:01-11

hii i am new flutter and facing following error

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);

this is my constructor in which i have passed title desc and timer

 Text(title, style: TextStyle(fontWeight: FontWeight.w400 ,
                  fontSize: 30),),
 Text(desc, style: TextStyle(fontWeight: FontWeight.w400 ,
                  fontSize: 15),),

while getting title and desc i am facing this error

CodePudding user response:

If your widget is stateful then you have to write title as

Text(widget.title, style: .......

CodePudding user response:

ok i use '${widget.title}' to solve this problem

  • Related