Starting with version 7, I have issues using Identity Marshaler for VM.
import "marshaler.vm.dart" //
if (dart.library.js) "marshaler.web.dart"
if (dart.library.js_interop) "marshaler.web.dart"
if (dart.library.html) "marshaler.web.dart";
For VM I have:
<redacted>
const dataSignatureMarshaler = IdentityMarshaler<DataSignature>();
const utxoListMarshaler = IdentityMarshaler<List<Utxo>>();
<redacted>
for WEB I Have:
<redacted>
const dataSignatureMarshaler = _DataSignatureMarshaler();
class _DataSignatureMarshaler implements SquadronMarshaler<DataSignature, Uint8List> {
const _DataSignatureMarshaler();
@override
Uint8List marshal(DataSignature data, [MarshalingContext? context]) => data.marshal();
@override
DataSignature unmarshal(Uint8List data, [MarshalingContext? context]) => DataSignature.unmarshal(data);
}
<redacted>
and the output Deser in worker is:
final class _$Deser extends MarshalingContext {
_$Deser({super.contextAware});
late final $0 = value<String>();
late final $1 = list<String>($0);
late final $2 = value<int>();
late final $3 = value<Uint8List>();
late final $4 = value<T>();
late final $5 = (($) => hdWalletMarshaler.unmarshal($4($), this));
late final $6 = (($) => networkIdMarshaler.unmarshal($4($), this));
<redacted>
}
Problem is that all the values get wrapped with $4 which is causing problems (cannot compile to web because of it). I believe the issue is caused by IdentityMarshaler.
Trying to change the imports to always use web instead of conditional imports leads to correct worker being generated (without that value wrapper).
Starting with version 7, I have issues using Identity Marshaler for VM.
For VM I have:
for WEB I Have:
and the output
Deserin worker is:Problem is that all the values get wrapped with
$4which is causing problems (cannot compile to web because of it). I believe the issue is caused byIdentityMarshaler.Trying to change the imports to always use
webinstead of conditional imports leads to correct worker being generated (without that value wrapper).