isar / isar/hive

Save Hive db in assets folder for future usage

Open
#660 0 comments 0 reactions 0 assignees View on GitHub
question
Dominant language
Dart
Stars
4.4k
Forks
449
PR merge metrics
No merged PRs in 30d

Description

I want to use a pre-populated db.

**Initialization:**

```
Directory directory = await pathProvider.getApplicationDocumentsDirectory();

Hive.init(directory.path);
Hive.registerAdapter(InventoryAdapter());
```
**Add initial data:**

```
addItem(Inventory item) async {
var box = await Hive.openBox('inventory');
box.put('abc', item);

var data = box.get('abc');
print(data.description); //looks good
}
```
**How to Get Database to use in future?**
I want to save this initial database in assets folder and will make it part of the build. How can I get this database?

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.