Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Padding(
padding: const EdgeInsets.all(8.0),
child: Icon(
password[0] == null ? unchangedPassword : changedPassword, //Error happens here
color: Colors.white,
size: 20,
),
)
]
)
有人可以解释一下为什么我不能编写 if 语句来检查索引处的值是否等于空值吗?
最佳答案
使用password.isEmpty
而不是password[0] == null
关于list - RangeError(索引): Invalid value. 有效值范围为空:0,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/68597632/