hive icon indicating copy to clipboard operation
hive copied to clipboard

built_value codegen support

Open KalilDev opened this issue 5 years ago • 8 comments

Is your feature request related to a problem? Please describe. I want to start using built_value from now on on my projects, and a big thing that needs adressing is hive support, as i do not want to write TypeAdapter s manually.

Describe the solution you'd like TypeAdapter codegen being built_value aware, being able to properly read and write like regular classes. Although, full proper support with HiveLists is a whole other beast because of the mutability of the structure

Describe alternatives you've considered Im preparing the described feature, but i wanted to know if it is an welcome addition to hive in general or if i should keep my changes local.

Version

  • Platform: iOS, Android, Mac, Windows, Linux, Web
  • Hive version: any

KalilDev avatar Jan 05 '21 15:01 KalilDev

I haven't tried built_value yet. So I don't know how does it works. We haven't planned to extend code generator library to support value builders. But any contributions are welcome if you want to add build_value support to hive. 😁

themisir avatar Jan 05 '21 20:01 themisir

Alright, my draft should support most built_value features, ill open an wip pr while i implement the remaining (EnumClass)

KalilDev avatar Jan 06 '21 03:01 KalilDev

https://github.com/hivedb/hive/pull/533

KalilDev avatar Jan 06 '21 16:01 KalilDev

This is great. Worked a treat with my existing BuiltValue classes.

mrdavidrees avatar Jan 21 '21 03:01 mrdavidrees

This is great. Worked a treat with my existing BuiltValue classes.

How did you manage this? did you just check out his PR and have it locally? and if so which commit did you take? im looking at this one https://github.com/hivedb/hive/tree/9c223e7519ed984991ad31e9064e1d2fe5ecebf4

martipello avatar Jun 30 '21 10:06 martipello

works for me also however its not null safe, ive started going through to try and make it null safe but its gonna take too long for me to commit to it

martipello avatar Jun 30 '21 12:06 martipello

any new on this? I'd love to help moving this forward

Leptopoda avatar Feb 19 '23 10:02 Leptopoda

Theres a repo that adds support, it generates the adapters fine and its also null safe:

https://pub.dev/packages/hive_built_value

But it has some inconsistencies and since that is not official I'm worried on long-term support.

For example this function is not in there:

Hive.resetAdapters();

danielgomezrico avatar Mar 01 '24 17:03 danielgomezrico