【问题标题】:How to get the value of an index in hive flutter?如何在 Hive Flutter 中获取索引的值?
【发布时间】:2020-07-20 13:07:13
【问题描述】:

我在 Flutter 中使用 hive 创建了一个动态数据库。如何获取某个索引中的值?我需要在 index 中获取 totalSec 的值。我要删除,所以我可以减去它的总时间,但我不知道怎么做。

下面是我的代码 sn-p 示例:

child: new InkWell(
  borderRadius: BorderRadius.circular(1000.0),
  onTap: () {
    newRoutineList.removeAt(index);
    rtnConfigBox.deleteAt(index);
    _rtnTotalSec = _rtnTotalSec - rtnConfigBox.getAt(index.totalSec); //Error: the getter 'totalSec' isn't defined for the class 'int'.
    setState(() {});
  },

【问题讨论】:

    标签: database flutter indexing dynamic flutter-hive


    【解决方案1】:

    您的实现似乎是正确的。但是 index.totalSec 必须是 int 值。

    Hive 文档包含您需要了解的有关使用该软件包的所有信息

    https://docs.hivedb.dev/#/basics/read_write

    【讨论】:

      猜你喜欢
      • 2021-04-09
      • 1970-01-01
      • 2020-10-13
      • 1970-01-01
      • 1970-01-01
      • 2022-11-21
      • 1970-01-01
      • 1970-01-01
      • 2020-05-19
      相关资源
      最近更新 更多