skip to Main Content

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

2

Answers


  1. Chosen as BEST ANSWER

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


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

    Text(widget.title, style: .......
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search