toJson method
This method is used in cases where it is necessary to export the class to
a Map (JSON)
.
When calling this function, a new _lastWritedMap
will be created to store
the Map that will be generated, and then the writeValues method that
has the Map generation structure will be executed.
Implementation
@mustCallSuper
Map<String, dynamic> toJson(
{bool exportOnlyChanged = false, bool ignoreNulls = false}) {
_exportOnlyChanged = exportOnlyChanged;
_ignoreNulls = ignoreNulls;
_lastWritedMap = {};
writeValues(_exportOnlyChanged, _ignoreNulls);
return _lastWritedMap;
}