isar / hive

Lightweight and blazing fast key-value database written in pure Dart.
Apache License 2.0
4.11k stars 410 forks source link

Unknown type: DateTime #991

Open mhdkadi opened 2 years ago

mhdkadi commented 2 years ago

Steps to Reproduce I run the app on the browser, I tried to store a class whose property is Datetime

Code sample @HiveType(typeId: 0) class Dealer { Dealer({ required this.expireTime, });

@HiveField(0) DateTime expireTime; }

Version

Error Error: HiveError: Cannot write, unknown type: DateTime. Did you forget to register an adapter? at Object.throw_ [as throw] (http://localhost:64886/dart_sdk.js:5080:11) at binary_writer_impl.BinaryWriterImpl.new.write (http://localhost:64886/packages/hive/src/box_collection.dart.lib.js:1355:21)

Mohamad-Alkurdi commented 2 years ago

I had the same issue after upgrading v2.0.5 to v2.1.0

wptmdoorn commented 2 years ago

I also have the same issue. Maybe defining the DateTime adapter locally in projects might be a temporary fix?

pynner commented 2 years ago

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

Looks like it has been fixed here, just not released yet

Macacoazul01 commented 2 years ago

I`m having it here too.

Currently using hive 2.1.0 on my web project.

@themisir when will #983 be released?

themisir commented 2 years ago

@Macacoazul01 sorry for the delay. Just published