无法在文本小部件中显示变量值(Flutter)

pla*_*smy 1 dart flutter

我有以下代码:

_places.forEach((element) {
  final String name = element.name;
  print(element);
  places.add(Card(
      child: InkWell(
          splashColor: Colors.blue.withAlpha(30),
          onTap: () {
            print('Card tapped.');
          },
          child: const SizedBox(
              width: 375,
              height: 100,
              child: Padding(
                padding: EdgeInsets.all(15.00),
                child: Text(
                  name
                )
              )))));
});
Run Code Online (Sandbox Code Playgroud)

我遇到的问题是该变量name在内部使用时出错Text

Error: Not a constant expression.

Eis*_*hon 7

请尝试从SizedBox中删除const。SizedBox 期望数据保持不变,但变量文本可以在运行时更改。const用于该值从编译时起就是常量的情况。