【发布时间】:2020-06-21 11:29:23
【问题描述】:
我想在这段代码中使用索引,但在代码中出现错误
Error: The argument type 'int' can't be assigned to the parameter type 'String'.
user.index,
^
代码
final index = Padding(
padding: EdgeInsets.all(8.0),
child: Text(
user.index,
style: TextStyle(fontSize: 14.0, color: Colors.black),
),
);
声明如下
class User {
final int index;
final String about;
final String name;
final String email;
final String picture;
User(this.index, this.about, this.name, this.email, this.picture);
}
【问题讨论】:
标签: json flutter dart error-handling flutter-layout