sizeHint method

  1. @override
int sizeHint(
  1. StorageEntryMetadata 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(StorageEntryMetadata value) {
  var size = 0;
  size += StrCodec.codec.sizeHint(value.name);
  size += StorageEntryModifier.codec.sizeHint(value.modifier);
  size += StorageEntryType.codec.sizeHint(value.type);
  size += U8SequenceCodec.codec.sizeHint(value.defaultValue);
  size += SequenceCodec(StrCodec.codec).sizeHint(value.docs);
  return size;
}