negotiate static method
Validates a native advertisement against its available symbol set.
Unadvertised older libraries use the legacy family. An unsupported or incomplete advertised ABI fails closed rather than mixing handle widths.
Implementation
static NativeMessageHandleAbi negotiate({
required int? version,
required bool Function(String symbol) providesSymbol,
}) {
if (version == null) return legacy;
if (version != 1) {
throw UnsupportedError('Unsupported native message handle ABI: $version');
}
for (final symbol in requiredWideSymbols) {
if (!providesSymbol(symbol)) {
throw UnsupportedError('Incomplete native message handle ABI: $symbol');
}
}
return wide;
}