checkSupportedPlatform static method

void checkSupportedPlatform(
  1. String libName, {
  2. required bool ios,
  3. required bool android,
  4. required bool macos,
  5. required bool windows,
  6. required bool linux,
  7. required bool web,
})

Implementation

static void checkSupportedPlatform(
  String libName, {
  required bool ios,
  required bool android,
  required bool macos,
  required bool windows,
  required bool linux,
  required bool web,
}) {
  if (web) return;
  final targets = <String>[
    if (ios) 'iOS',
    if (android) 'Android',
    if (macos) 'macOS',
    if (windows) 'Windows',
    if (linux) 'Linux',
  ].join(', ');
  throw UnsupportedError(
    '$libName: this generated Nitro module does not target Web. Targeted '
    'platforms: ${targets.isEmpty ? 'none' : targets}. Add '
    '`web: NativeImpl.wasm` to @NitroModule, regenerate with '
    '`nitrogen generate`, run `nitrogen link`, and rebuild the app.',
  );
}