toJson method
To be called for a custom json serialization. This is not a chainable call. If the result is writeable by the stringifier, it will result in an exception.
Implementation
@override
dynamic toJson() {
final result = fold<Object>(
(js) => js.toJson() as Object,
(str) => str,
(unit) => unit
);
if (result is Unit) {
return null;
}
return result;
}