file - 为什么我在颤动中从 FileUtilsDisplayTime() 中获取先前保存的值?
问题描述
我想读取我的时间并传递给我的 toast 函数。但我得到的是以前存储的数字而不是当前值。
这是代码:
String time = '2';
String getTimeForDisplay() {
FileUtilsDisplayTime().readFromFile().then((String value) {
time = value;
print("time from file---" + time);
});
return time;
}
void notificationToast() {
String s = getTimeForDisplay();
int timeIn = int.parse(s);
print("time incoming---------" + s);
Fluttertoast.showToast(
msg: "------------------------------------------------message---------",
toastLength: Toast.LENGTH_LONG,
timeInSecForIos: timeIn,
gravity: ToastGravity.BOTTOM,
backgroundColor: Colors.black,
textColor: Colors.red,
fontSize: 16.0);
}
传入的时间和来自文件的时间不是相同的值吗?
解决方案
推荐阅读
- optimization - 决策树的 CART 算法中的基尼指数如何最小化?
- wordpress - Wordpress Contact Form 7 集成 WP Webhook 不工作
- python - 如何在pandas python中获取数据框中三列的所有组合>
- otrs - 如何重置 OTRS 中响应的升级?
- javascript - 如何让 3DSecure 模式与 Stripe Payment 意图一起使用?
- javascript - HTML 元素 DIV 在 Selenium 推出的 Chrome 中消失
- java - 为什么 passwordEncoder() 是 @Bean?
- c# - WPF 选择输入音频并设置输出设备音频
- ibm-integration-bus - IIB 收集器节点和交易
- reactjs - 样式化组件不会在页面加载时应用任何样式