afterSerialize method

  1. @override
Object? afterSerialize(
  1. Object? object,
  2. FullType specifiedType
)
override

Implementation

@override
Object? afterSerialize(Object? object, FullType specifiedType) {
  if (object is List && !typesToLeaveAsList.contains(specifiedType.root)) {
    if (specifiedType.isUnspecified) {
      return _toMapWithDiscriminator(object);
    } else {
      return _toMap(object, _needsEncodedKeys(specifiedType));
    }
  } else {
    return object;
  }
}