wasm2wasmComponent method

Future<Result<Uint8List, ParserError>> wasm2wasmComponent({
  1. required WasmInput input,
  2. String? wit,
  3. required List<ComponentAdapter> adapters,
})

Implementation

Future<Result<Uint8List, ParserError>> wasm2wasmComponent({
  required WasmInput input,
  String? wit,
  required List<ComponentAdapter> adapters,
}) async {
  final results = await _wasm2wasmComponent([
    input.toWasm(),
    (wit == null ? const None().toWasm() : Option.fromValue(wit).toWasm()),
    adapters.map((e) => e.toWasm()).toList(growable: false)
  ]);
  final result = results[0];
  return withContext(() => Result.fromJson(
      result,
      (ok) =>
          (ok is Uint8List ? ok : Uint8List.fromList((ok! as List).cast())),
      (error) => error is String ? error : (error! as ParsedString).value));
}