decode method

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

Implementation

@override
ItemDeprecationInfo decode(Input input) {
  final index = U8Codec.codec.decode(input);

  switch (index) {
    case 0:
      return const ItemNotDeprecated();
    case 1:
      return const ItemDeprecatedWithoutNote();
    case 2:
      final note = StrCodec.codec.decode(input);
      final hasSince = BoolCodec.codec.decode(input);
      final since = hasSince ? StrCodec.codec.decode(input) : null;
      return ItemDeprecated(deprecationNote: note, deprecationSince: since);
    default:
      throw Exception('Unknown ItemDeprecationInfo variant: $index');
  }
}