问题描述
我想格式化从timePicker获得的时间,但是出现错误。当我尝试格式化时间并且不知道为什么时,变量 t (String formatedTime = new DateFormat('HH:mm').format(t);
)带有红色下划线。
这是我尝试的代码:
pickTime() async {
TimeOfDay t = await showTimePicker(
context: context,initialTime: pickedTime,);
if (t != null) {
setState(() {
pickedTime = t;
print(pickedTime.toString());
String formatedTime = new DateFormat('HH:mm').format(t);
print(formatedTime.toString());
});
}
}
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)