decodeValue method

  1. @override
List<T> decodeValue(
  1. Pipe x,
  2. CType t
)
override

Implementation

@override
List<T> decodeValue(Pipe x, CType t) {
  final opt = checkType(t);
  if (opt is! OptClass) {
    throw TypeError();
  }
  final len = Uint8List.fromList(safeRead(x as Pipe<int>, 1)).toHex();
  if (len == '00') {
    return [];
  } else if (len == '01') {
    return [_type.decodeValue(x, opt._type)];
  }
  throw UnsupportedError('not an option value.');
}