- @override
Converts this instance into a serializable map.
This method returns a map of the key-values pairs in this instance. This value is typically converted into a transmission format like JSON.
Only properties present in backingMap are serialized, otherwise, they are omitted from the map. If a property is present in backingMap and the value is null, the value null will be serialized for that property key.
Usage: var json = JSON.encode(model.asMap());
Source
@override Map<String, dynamic> asMap() { var outputMap = <String, dynamic>{}; backing.valueMap.forEach((k, v) { outputMap[k] = _valueEncoder(k, v); }); var reflectedThis = reflect(this); entity.attributes.values .where((attr) => attr.transientStatus?.isAvailableAsOutput ?? false) .forEach((attr) { var value = reflectedThis.getField(new Symbol(attr.name)).reflectee; if (value != null) { outputMap[attr.name] = value; } }); return outputMap; }