Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Box not found. Did you forget to call Hive.openBox()?

Tags:

flutter

When working with HIVE database in flutter. If you ever get error like this:

"Box not found. Did you forget to call Hive.openBox()?"

It means you haven't opened your box to

To resolve this issue call

await Hive.openBox("boxname");

before using the box

like image 793
vivek yadav Avatar asked Dec 21 '19 14:12

vivek yadav


People also ask

How do you use hive in flutter?

With hive, before you can read/compose data, a box should be opened. Boxes can be opened with await Hive. Openbox('name') can get an instance of an opened box with Hive. Box ('name'), where 'name' is the name of the case (saying the DB name). You can call Hive.


1 Answers

It means you haven't opened your box. To resolve this issue call

await Hive.openBox("boxname");

before using the box.

like image 196
Alexander van Oostenrijk Avatar answered Oct 22 '22 13:10

Alexander van Oostenrijk