decode method

  1. @override
Result<R, E> decode(
  1. Input input
)
override

Implementation

@override
Result<R, E> decode(Input input) {
  final index = input.read();
  switch (index) {
    case 0:
      return Result.ok(okCodec.decode(input));
    case 1:
      return Result.err(errCodec.decode(input));
    default:
      throw Exception('Invalid index for Result: $index');
  }
}