wrapWithClassName method
Wraps serialized data with its class name so that it can be deserialized
with deserializeByClassName
.
Implementation
Map<String, dynamic> wrapWithClassName(Object? data) {
var className = getClassNameForObject(data);
if (className == null) {
throw ArgumentError(
'Could not find class name for ${data.runtimeType} in serialization.',
);
}
return {
'className': className,
'data': data,
};
}