当我尝试使用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
...
════════════════════════════════════════════════════════════════════════════════
答案 0 :(得分:1)
自astroid==2.3.3
attrs==19.3.0
behave==1.2.6
certifi==2019.11.28
chardet==3.0.4
idna==2.8
isort==4.3.21
lazy-object-proxy==1.4.3
lxml==4.4.2
mccabe==0.6.1
parse==1.14.0
parse-type==0.5.2
Pillow==5.4.1
pylint==2.4.4
pypng==0.0.20
requests==2.22.0
six==1.14.0
tinycss2==0.6.1
transitions==0.6.9
typed-ast==1.4.0
ua-parser==0.8.0
urllib3==1.25.7
webencodings==0.5.1
wrapt==1.11.2
xmlrunner==1.7.7
regex==2020.5.7
刚刚升级依赖项以来,此问题已解决