Open michelemazzei opened 5 months ago
the registration is incorrect should be something like
Hive.registerAdapter(Person Adapter());
@oscarshaitan could you explain?
All this is with hive 2.2.3 You have this enum for example with all the hive annotation hive will create an adapter for you inside 'distance_unit.g.dart'
Thats the adapter you have to register
if you dont use the hive annotations you still can do it but you have to create the adapter by hand
right now if you want to play with the V4 I'll suggest you to try other solution like sembast that is json oriented the main project has been 2 years radio silent and the v4 close to 1 year. Im using currently Hive 2.2.3 but in few weeks Ill do the change. I did a bench quite tailored to my needs https://www.linkedin.com/pulse/replacing-hive-seeking-more-robust-flexible-storage-oscar-tigreros-hd5he/?trackingId=UZnb5cTgnQ%2BCx%2Bq8rI%2BiHw%3D%3D
but could help you understand what you can do
To register a serializable object in Hive the method to use is:
Hive.registerAdapter('Bee', Bee.fromJson);
But, if you use the example code:
It does not compile the register Adapter method. More over if I try to force to compile (with a cast) it takes an error at runtime. Cannot use 4.0.0.dev2 , must use the 2.2.3 with @HiveType and HiveObject.