Open subzero911 opened 3 years ago
@subzero911 I found a workaround for your case. Already tried and tested.
user.wallets = HiveList(walletsBox).cast();
@subzero911 I found a workaround for your case. Already tried and tested.
user.wallets = HiveList(walletsBox).cast();
Thank you for your reply.
I found in a docs, that HIve doesn't support collections as a Box generic parameter.
So it's my mistake.
The workaround is to create a wrapper WalletList
class, that contains this List<CryptoWallet>
.
So the box type is Box<WalletList>
user.wallets = HiveList(walletsBox).cast();
It's not intended use. HiveList is for relations (list of other objects stored in Hive).
Steps to Reproduce
I want to store a box where key is user ID and value is List of Wallet (every Wallet is a HiveObject). I also want a user to have a HiveList of its wallets. The problem is adding to HiveList requires to check if HiveObject is inside of box. And when I add to box not a HiveObject directly, but a
List<HiveObject>
, thebox
property of every HiveObject is null!Desired behaviour: if I put a collection into box, every element should also have a reference to this box in its
box
propertyCode sample
Version