在flutter代码里面明明定义了keyvalue2变量,但是系统却总是提升错误,无法识别,说没有定义keyvalue2(错误提示:undefined name 'keyvalue2'),这是为什么呢?
请高手帮忙解释一下
谢谢
class getDataListZ extends StatefulWidget {
late int keyvalue2;
getDataListZ({Key? key, required this.keyvalue2});
@override
_getDataListZState createState() => _getDataListZState();
}
class _getDataListZState extends State<getDataListZ> {
@override
Widget build(BuildContext context) {
print("gdDataListZ");
print(keyvalue2);
return Container(
child: Column(
children: [
Text(menuList[keyvalue2]['title2']),
Visibility(
child: Text("Count ${context.watch<CountModle>().count}"),
visible: false,
),
],
));
}
}