Skip to content

Improve handling of Box of custom List and Map types #150

@joyhope

Description

@joyhope

Question
I tried to save List into Hive as an object, but the save is correct, I do not know how to read out.

Code sample
My box is used in the following style.

rbox=Hive.openBox<List<CallLog>>(boxName);

I use

List<CallLog> values
...
rbox.add(values); 

The box adds is a success, but I do not know how to read the List.

If I use debug mode, the error will display. I do not understand how to meet the requirement.

      'Cannot open a box of type $type. It is not possible to read Iterables of custom types. Use Iterable.cast<R>() after reading.',

Some of my List could be read back, some will meet List is not a subtype of List I am very confused about the result.

Version

  • Platform: android
  • Flutter version: 3.32.0
  • Hive version: ^2.11.3

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions