这个表达式的类型为void,所以它的值不能用于flutter

问题描述 投票:0回答:1

如何在我的 flutter 项目中解决这个错误

this expression has a type of void so its value cant be used.

这是我的代码:

Future<void> _updateItem(item) async {
final acc = await _box.get(widget.phone);
List putit = acc["transaction"];
var save_hive = putit.add(item);

print(save_hive);
final gg = _box.put(widget.phone, save_hive);
  }

希望得到帮助,感谢您对我的问题的影响。

flutter void flutter-hive
1个回答
0
投票

putit.add(item)
返回了一个空值
save_hive
,不能在
print(save_hive)

中使用
© www.soinside.com 2019 - 2024. All rights reserved.