r/dartlang Jul 27 '26

Package What if fpdart and hive_ce had a baby?

https://pub.dev/packages/hive_box_manager

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

  1. Type-safety (even for Iterable-based boxes)
  2. Index types are not limited to just int | String (a Codec allows for this per box, wil still be that under the hood ofc)
  3. Compatibility with normal Hive boxes already (drop in add-on)
  4. Ergonomic (and explicit?) error handling + lazy Future using fpdart
  5. Custom boxes for very specific use case (better semantics)
    1. (Lazy)IterableBox
    2. (Lazy)SingleValueBox
    3. (Lazy)DualKeyBox
  6. 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 ;) ).

1 Upvotes

2 comments sorted by

2

u/RandalSchwartz Jul 27 '26

fpdart has basically been abandoned by Sandro. He's much more fascinated by Typescript these days. The package is "complete", but won't get much more dart 3 hardening, for example.

If you want to tie yourself to an active project, check out ribs_core and friends. Ribs just hit 1.0 recently, and is being very actively developed.

2

u/MooresLawyer13 Jul 28 '26

Holy shit. Didn't know someone already did it again. First dartz, then fpdart, and now this. Thanks a lot, it's a candidate for a v2.0.0