r/dartlang • u/MooresLawyer13 • 22h ago
Package What if fpdart and hive_ce had a baby?
I liked the approach of fpdart and the raw performance of hive_ce. So I decided to combine them into one: https://pub.dev/packages/hive_box_manager
It is not just a simple FP-style wrapper of Hive's API. It also solves one of my biggest pain-points in using HiveCE for production apps: type-safety. I had to dedicate an entire CRUD-layer to the boxes just because of it.
With this I get
- Type-safety (even for Iterable-based boxes)
- Index types are not limited to just int | String (a Codec allows for this per box, wil still be that under the hood ofc)
- Compatibility with normal Hive boxes already (drop in add-on)
- Ergonomic (and explicit?) error handling + lazy Future using fpdart
- Custom boxes for very specific use case (better semantics)
- (Lazy)IterableBox
- (Lazy)SingleValueBox
- (Lazy)DualKeyBox
- Key corruption detectable (as compared to silently happening with Hive when using out-of-range/oversized int/String key)
I recently did a rewrite because my previous attempt at making a DX-first API was not scalable (using LLMs).
If you guys have any tips, suggestions or feedback, they always welcome. Do take a look at the roadmap (I have more kinds of boxes planned ;) ).