我收到以下 lint
Text("The color is " + item['color'])
“使用插值来组合字符串和值。(文档)尝试使用字符串插值来构建复合字符串。”
以下是代码在我的 ListView / ListTile 中的使用方式。我怎样才能重写得更好,没有任何提示。
child: ListView.separated(
itemCount: dataList.length,
itemBuilder: (ctx, index) {
final item = dataList[index];
return ListTile(
title: item['value'] == ''
?
Text(
"The color is " + item['color'])
你可以使用
Text("The color is ${item['color']}")
而不是
Text("The color is " + item['color'])