dartApiDlForwarderContent function

String dartApiDlForwarderContent(
  1. String nitroNativePath
)

Returns the content of a dart_api_dl.c forwarder that includes the real file from the resolved nitro native path.

Prefer bundledDartApiDlContent for SPM targets. Use this forwarder only for the legacy src/dart_api_dl.c (CocoaPods / CMake) path where the nitro native path is always available on the local machine.

Implementation

String dartApiDlForwarderContent(String nitroNativePath) {
  final includePath = nitroNativePath.replaceAll(r'\', '/').trimRight();
  return '// Generated by nitrogen link — do not edit.\n'
      '// Compiled as C (not C++) so the void*/function-pointer casts\n'
      '// in dart_api_dl.c are accepted by the compiler.\n'
      '#include "$includePath/dart_api_dl.c"\n';
}