checkAbiVersion static method

void checkAbiVersion(
  1. String libName,
  2. int readVersion()
)

Implementation

static void checkAbiVersion(String libName, int Function() readVersion) {
  late final int actual;
  try {
    actual = readVersion();
  } catch (error) {
    throw StateError(
      '$libName: Nitro ABI version check failed. Run `nitrogen generate` '
      'and `nitrogen link`, then rebuild the WASM module '
      '(web/build_web.sh). Details: $error',
    );
  }
  if (actual != expectedAbiVersion) {
    throw StateError(
      '$libName: Nitro ABI version mismatch. Dart runtime expects '
      '$expectedAbiVersion but the WASM bridge reports $actual. Run '
      '`nitrogen generate`, rebuild the WASM module, and rebuild the app.',
    );
  }
}