gpt4 book ai didi

flutter - Hive.box ('box_name').listenable()get,在null上调用 `The method ' toSet',在flutter上出错

转载 作者:行者123 更新时间:2023-12-03 03:34:41 25 4
gpt4 key购买 nike

当我尝试使用here is an example on web Hive.box('box_name')。listenable()时,如果没有键,则会发生错误;

════════ Exception caught by widgets library ═══════════════════════════════════
The following NoSuchMethodError was thrown building FutureBuilder<dynamic>(dirty, state: _FutureBuilderState<dynamic>#566bb):
The method 'toSet' was called on null.
Receiver: null
Tried calling: toSet()

The relevant error-causing widget was
FutureBuilder<dynamic>
package:hive_benchmark/sketcpad/sketchpad.dart:109
When the exception was thrown, this was the stack
#0 Object.noSuchMethod (dart:core-patch/object_patch.dart:53:5)
#1 BoxX.listenable
package:hive_flutter/src/box_extensions.dart:11
#2 _DrawingScreenState.build.<anonymous closure>
package:hive_benchmark/sketcpad/sketchpad.dart:120
#3 _FutureBuilderState.build
package:flutter/…/widgets/async.dart:732
#4 StatefulElement.build
package:flutter/…/widgets/framework.dart:4619
...
════════════════════════════════════════════════════════════════════════════════

最佳答案

由于hive_flutter: ^0.3.0+2只是升级了依赖项,因此已解决此问题

关于flutter - Hive.box ('box_name').listenable()get,在null上调用 `The method ' toSet',在flutter上出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61747988/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com