Evaluation of this constant expression throws an exception.dart(const_eval_throws_exception)
Followowing is my FLutter code
child: Card(
child: Column(
//mainAxisSize: MainAxisSize.max,
children: <Widget>[
const ListTile(
//leading: Icon(Icons.album),
title: Text(post['title']),
subtitle: Text(
"by ${post['user']['name']}"),
),
],
),
),
This is throwing the following error
dynamic post
Evaluation of this constant expression throws an exception.dart(const_eval_throws_exception)
Arguments of a constant creation must be constant expressions.
Try making the argument a valid constant, or use 'new' to call the constructor.dartconst_with_non_constant_argument
Peek Problem (⌥F8)
No quick fixes available
1 Answer
4 years ago by flutterdev
remove the const before the ListTile. Change your code to the following
child: Card(
child: Column(
//mainAxisSize: MainAxisSize.max,
children: <Widget>[
ListTile(
//leading: Icon(Icons.album),
title: Text(post['title']),
subtitle: Text(
"by ${post['user']['name']}."),
),
],
),
),
4 years ago by Karthik Divi