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 'Not an option type';
  }
  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)];
  } else {
    throw 'Not an option value';
  }
}