Serialize a value without requiring the caller to know I.
I
Object? serializeUntyped(Object? value) => serialize(value as I);