hive.box('box\u name').listenable()get,'the method'toset'was called on null',error on flutter

erhoui1w  于 2021-06-24  发布在  Hive
关注(0)|答案(1)|浏览(356)

当我尝试在web hive.box('box\u 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
...
════════════════════════════════════════════════════════════════════════════════
iyfamqjs

iyfamqjs1#

这个问题从那时起就解决了 hive_flutter: ^0.3.0+2 只是升级依赖关系

相关问题