decode method

  1. @override
StorageEntryType decode(
  1. Input input
)
override

Implementation

@override
StorageEntryType decode(Input input) {
  final variantType = input.read();
  TypeId value;
  TypeId? key;
  List<StorageHasher> hashers;
  switch (variantType) {
    case 0:
      {
        hashers = [];
        key = null;
        value = TypeIdCodec.codec.decode(input);
        break;
      }
    case 1:
      {
        hashers = SequenceCodec(StorageHasher.codec).decode(input);
        key = TypeIdCodec.codec.decode(input);
        value = TypeIdCodec.codec.decode(input);
        break;
      }
    default:
      throw Exception('Unknown StorageEntryType variant index $variantType');
  }
  return StorageEntryType(
    hashers: hashers,
    key: key,
    value: value,
  );
}