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 'Cannot decode function reference';
  }
  final canister = decodePrincipalId(x);

  final mLen = (lebDecode(x).toInt());
  final buf = Uint8List.fromList(safeRead(x, mLen));
  if (!isValidUTF8(buf)) {
    throw 'Not valid UTF8 method name';
  }
  final method = buf.u8aToString();
  return [canister, method];
}