I´m new to flutter and got a question that makes me crazy for 2 days :) I want to use a parameter(name1) in a list, but can´t figure out what went wrong:
List<Widget> player = [Text(name1)];
String name1 = 'Max';
@override
Widget build(BuildContext context) {
return Container(
child: player[0],
);
}
}
Error: Can't access 'this' in a field initializer to read 'name1'
This is a simplified version, but includes the problem.