getMaxSize function
Returns the max size of a codec, encoder, or decoder.
For fixed-size objects, returns the fixed size.
For variable-size objects, returns maxSize (which may be null).
Implementation
int? getMaxSize(Object codec) {
if (codec is FixedSizeEncoder) return codec.fixedSize;
if (codec is FixedSizeDecoder) return codec.fixedSize;
if (codec is FixedSizeCodec) return codec.fixedSize;
if (codec is VariableSizeEncoder) return codec.maxSize;
if (codec is VariableSizeDecoder) return codec.maxSize;
if (codec is VariableSizeCodec) return codec.maxSize;
return null;
}