wrapWithClassName method

Map<String, dynamic> wrapWithClassName(
  1. Object data
)

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);
  assert(
    className != null,
    'Could not find class name for ${data.runtimeType} in serialization.',
  );

  return {
    'className': className,
    'data': data,
  };
}