Closed duard-sf closed 3 months ago
null is not supported (only for the root value, a map or a list can contain null) sorry I will check the documentation. Firestore (AFAIK) does not support null neither for its root value (it can only be an empty map).
Alternatively, the README should be updated to remove null as a supported value
As I said you can have {'test': null} or [1, null, 'test]. But indeed a record data itself cannot be null like almost any database so I'm not sure what recommendation I could make.
Yes, you're right. Firestore documents cannot be null themselves, but their fields can.
My confusion arose from this part of the README:
Which is unclear about what is actually allowed to be null. In my case, I interpreted this as a record's value can be null, so this is valid: await store.record(123).put(db, null)
.
Since this is working as designed, I guess this issue can be closed. Thanks for the quick help!
I have added some clarification (that will be available the next time the package is updated): https://github.com/tekartik/sembast.dart/commit/f0ea94a57ce35d9aa37f95f284a9d8a8a69c424c
The README reports that a record may have
null
as its value. However,SembastRecordRefExtension._checkValueArgument
throwsArgumentError.notNull
if the value isnull
. Additionally, the CHANGELOG reports thatnull
is no longer supported for record values since version 3.0.0+6.Ideally, I would like to have seen support for nullable record values remain. There are similarities between Sembast and Firestore, and Firestore does support
null
values.Alternatively, the README should be updated to remove
null
as a supported value. I would also really appreciate some recommendations on how to handle nullable values in Sembast added to README.