decodeValue method

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

Implementation

@override
List<dynamic> decodeValue(Pipe x, CType t) {
  final r = Uint8List.fromList(safeRead(x as Pipe<int>, 1)).toHex();
  if (r != '01') {
    throw ArgumentError('Cannot decode function reference $x.');
  }
  final canister = decodePrincipalId(x);
  final mLen = lebDecode(x).toInt();
  final buf = Uint8List.fromList(safeRead(x, mLen));
  if (!_isValidUTF8(buf)) {
    throw ArgumentError('Not a valid UTF-8 method name.');
  }
  final method = buf.u8aToString();
  return [canister, method];
}