Questions tagged [flutter-hive]

Use this tag when the question is related to the key-value database written in Dart, in combination with a project written in Flutter.

Summary

Hive is a key-value database written in pure Dart.

The data are arranged in boxes, which can also be encrypted for the storage of sensitive data. The box must be opened before use.

Useful Links

380 questions
0
votes
3 answers

Using Hive.box("user") throws the error The box "user" is already open and of type Box

I know this question has been asked before, but the solution doesn't help me. according to the hive doc, an opened box can be called like this Hive.box('myBox'); when I try this in my code I get the error The box "user" is already open and of type…
Thanoss
  • 439
  • 5
  • 11
0
votes
1 answer

Getting error: Box' can't be assigned to the parameter type 'ValueListenable'

I'm new to flutter and I'm using Hive as my DB. I'm trying to use the ValueListenableBuilder Widget to listen to new DB updates. But I'm getting the below error. The argument type 'Box' can't be assigned to the parameter type…
0
votes
1 answer

How to use Hive to store data in Flutter

I'm learning flutter and I'd like to make a simple todo app. In the app you can create different "lists" (for example "Homework", "groceries"...) and each list consists of list of tasks, so I have to classes: Task (to store a single task) String…
btm2424
  • 581
  • 6
  • 16
0
votes
0 answers

HiveDB in macos build flutter

I have a flutter app that uses hiveDB, its working perfectly on iOS device and simulator, but when building it on macOS, the following error pops. Unhandled Exception: HiveError: Cannot read, unknown typeId: 32. Did you forget to register an…
SinaMN75
  • 6,742
  • 5
  • 28
  • 56
0
votes
1 answer

How to dynamically load data to DataTable in a SIMPLE fashion with Hive box & indexing in Flutter/Dart?

I want a very SIMPLE way of populating my DataTable dynamically and being able to refresh it when new data is added so it updates & rebuilds instantly. Using Hive boxes and in the simplest fashion possible. I am using Hive encrypted boxes, but that…
RobbB
  • 1,214
  • 11
  • 39
0
votes
2 answers

How to read/update/delete by value(not by index) in Dart using Hive?

Sample deleteItem(int index) { final box = Hive.box("deliveries"); box.deleteAt(index); } I'd like to change index parameter to the id of my object), like this deleteItem(int id) { final box =…
rmontemayor0101
  • 137
  • 2
  • 8
0
votes
1 answer

Objects deleted from Hive box are still loaded to memory

In my Flutter App I have a Hive box with Player objects. Just to debug I'm outputting some data from my player objects in the constructor, like this: Player({ @required String name, @required this.id, }) { this.name =…
Christoffer
  • 7,470
  • 9
  • 39
  • 55
0
votes
1 answer

Do I need to create extra model for Hive TypeAdapter creation in flutter?

I have Expense Model, class Expense { String id; String amount; String details; String type; DateTime date; ExpenseMode mode; Expense( {this.id, this.amount, this.details, this.type, this.date, this.mode}); …
Mrudul Addipalli
  • 574
  • 6
  • 10
0
votes
2 answers

Dart Hive TypeAdapter rational for write() method

I am trying to understand the rational behind using writeByte(3) in the write method in Hive TypeAdapter. Please consider the class: @HiveType() class Person{ @HiveField(0) String name; @HiveField(1) int age; } In the TypeAdapter below It…
Denio Mariz
  • 1,065
  • 1
  • 10
  • 12
0
votes
1 answer

Leveraging Hive Box data and Firestore Streams

On Flutter Web, I have a stream from firestore which displays the current messages in a collection but when the internet is not available I can't have access to those messages from that stream. I Decided to use a hive box to cache the messages and…
0
votes
1 answer

type 'String' is not a subtype of type 'FontStyle'

Im trying to store FontStyle Value and FontWeight Value in HIVE Database in Flutter as String Values. However while fetching the values, im facing the issue of not being able to convert String value to FontStyle or FontWeight Value. I could use If…
Sarah Jackson
  • 21
  • 1
  • 1
0
votes
0 answers

Flutter offline data changes in Hive, ListView UI not updating when data changes

//----- I am trying to refresh UI when product quantity increases or decreases in Hive DB-----// //---------------My HIVE Class--------------------------// @HiveType(typeId: 0) class ProductDBModel extends HiveObject{ @HiveField(0) int id; …
0
votes
1 answer

Open hive box with different adapters in flutter

I am having 2 adapters. I have registered both adapters in main method. I am having only 1 box because database is only one, inside that tables can be multiple. So I am not able to open same box with different adapter in hive in flutter. eg : …
0
votes
2 answers

How to solve the Box not Found error Hive Flutter

I have a homescreen in which I have created a 4 navigation screen, so when user enter login id and password then it calls the homescreen. But for the first time when user navigate to the homescreen it shows the Box is not initialized but when I…
Jaydip Pawar
  • 125
  • 4
  • 16
0
votes
0 answers

Flutter Hive how to clear cache

I use hive: ^1.4.4+1 and hive_flutter: ^0.3.1. I have a problem with box.get after updating a box. It gets the cached version of the object, not the version in the .hive file. For example: Box box = await Hive.openBox('box1'); box.put('configData',…
Bo Hellgren
  • 109
  • 9