I use a class with a private bool field and assign true to it. In the setter I make sure that the given value is not null (in case null is assigned in the deserialization process). The dart dev compiler always complains when there are bools with null values.
Dartson documentation points out, that it never serializes or deserializes private fields.
// private members are never serialized
String _private = "name";
Yet it does for me and it also ignores my public getter and setters;
@Entity()
class MyClass implements StaticEntity {
bool _myPrivateBool = true;
bool get myBool => _myPrivateBool ;
void set myBool(bool value) {
if (value != null)
_myPrivateBool = value;
}
I use a class with a private bool field and assign true to it. In the setter I make sure that the given value is not null (in case null is assigned in the deserialization process). The dart dev compiler always complains when there are bools with null values.
Dartson documentation points out, that it never serializes or deserializes private fields.
Yet it does for me and it also ignores my public getter and setters;
@Entity() class MyClass implements StaticEntity { bool _myPrivateBool = true;
bool get myBool => _myPrivateBool ;
void set myBool(bool value) { if (value != null) _myPrivateBool = value; }
void dartsonEntityDecode(Map obj, TypeTransformerProvider dson) { // ... this._myPrivateBool = obj["_myPrivateBool"]; // ... }