wrapWithClassName method

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

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,
  };
}