当我尝试在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
...
════════════════════════════════════════════════════════════════════════════════
1条答案
按热度按时间iyfamqjs1#
这个问题从那时起就解决了
hive_flutter: ^0.3.0+2
只是升级依赖关系