sizeHint method

  1. @override
int sizeHint(
  1. EnumDeprecationInfo value
)
override

If possible give a hint of expected size of the encoding.

This method is used inside default implementation of encode to avoid re-allocations.

Implementation

@override
int sizeHint(EnumDeprecationInfo value) {
  var size = CompactCodec.codec.sizeHint(value.deprecatedVariants.length);
  for (final entry in value.deprecatedVariants.entries) {
    size += 1; // u8 key
    size += VariantDeprecationInfo.codec.sizeHint(entry.value);
  }
  return size;
}