commands/link_command
library
Functions
-
cleanRedundantIncludes(File file)
→ void
-
-
-
detectManagedContentIssues({String baseDir = '.'})
→ List<ManagedContentIssue>
-
Scans Plugin.kt and Plugin.swift for managed sections (JniBridge import,
register() call, Registry.register) that are expected for non-cpp modules
but are currently missing. Returns each gap as a ManagedContentIssue.
-
discoverModuleInfos(String pluginName, {String baseDir = '.'})
→ List<ModuleInfo>
-
-
discoverModules(String pluginName, {String baseDir = '.'})
→ List<Map<String, String>>
-
-
ensureIosPackageSwift(String pluginName, {String baseDir = '.', List<ModuleInfo>? moduleInfos})
→ void
-
-
ensureMacosPackageSwift(String pluginName, {String baseDir = '.', List<ModuleInfo>? moduleInfos})
→ void
-
Mirrors ensureIosPackageSwift for
macos/. Creates the Flutter 3.41+
nested SPM layout (macos/<pluginName>/Package.swift) if not present,
then syncs C/C++ module sources into SPM Sources directories.
-
-
findPodfileDirs(String projectRoot)
→ List<String>
-
Returns directories containing a Podfile, searching common locations:
<root>/ios/, <root>/macos/, <root>/example/ios/, <root>/example/macos/,
and any direct child */ios/ or */macos/.
-
generateCMake(String pluginName, List<String> moduleLibs, String nitroNativePath, {String baseDir = '.', List<ModuleInfo>? moduleInfos})
→ void
-
-
isAndroidCppModule(File specFile)
→ bool
-
Returns true ONLY when the spec declares
android: NativeImpl.cpp (or AndroidNativeImpl.cpp).
Unlike isNativeCppModule this does NOT match linux-only C++ modules.
-
isAppleCppModule(File specFile)
→ bool
-
Returns true when the spec file uses direct C++ for Apple platforms (ios or macos).
Only Apple C++ modules need a
HybridXxx.cpp forwarder in ios/Classes/ or
macos/Classes/ so CocoaPods compiles the implementation into the pod target.
-
isCppModule(File specFile)
→ bool
-
Returns true when the spec file declares at least one platform as a
direct C++ implementation (no JNI/Swift bridge). Recognises both:
-
isIosCppModule(File specFile)
→ bool
-
Returns true when the spec file uses direct C++ specifically for iOS.
Use this instead of isAppleCppModule when deciding whether the iOS Swift
Plugin.swift needs a
Registry.register() call — a mixed module with
ios: swift, macos: cpp still needs the iOS Swift registration.
-
isMacosCppModule(File specFile)
→ bool
-
Returns true when the spec file uses direct C++ specifically for macOS.
Use this instead of isAppleCppModule when deciding whether the macOS Swift
Plugin.swift needs a
Registry.register() call — a mixed module with
ios: cpp, macos: swift still needs the macOS Swift registration.
-
isNativeCppModule(File specFile)
→ bool
-
Returns true when the spec file uses direct C++ for Android or Linux —
the platforms that share
src/CMakeLists.txt (Android NDK / Linux GCC).
-
isWindowsCppModule(File specFile)
→ bool
-
Returns true when the spec file uses direct C++ for Windows only.
Windows C++ modules use
windows/CMakeLists.txt (not the shared src/)
and need their own impl stub created in windows/src/.
-
linkAndroid(String pluginName, List<String> moduleLibs, {String baseDir = '.', List<ModuleInfo>? moduleInfos})
→ void
-
Configures
android/build.gradle (or .kts) so the generated Kotlin bridge
files in lib/src/generated/kotlin/ are compiled as part of the Android build.
-
linkClangd(String pluginName, {List<ModuleInfo>? moduleInfos, String baseDir = '.'})
→ void
-
-
linkCMake(String pluginName, List<String> moduleLibs, String nitroNativePath, {String baseDir = '.', List<ModuleInfo>? moduleInfos})
→ void
-
-
linkCppImplStubs(List<ModuleInfo> moduleInfos, {String baseDir = '.'})
→ void
-
Builds the
#if guard condition that determines on which platforms the
auto-register call should fire inside a src/HybridXxx.cpp stub.
For each NativeImpl.cpp module that targets Android, Linux, iOS, or macOS,
creates a starter src/Hybrid${Module}.cpp stub if one doesn't already exist.
-
linkKotlinLoadLibraries(List<String> libs, {String baseDir = '.'})
→ void
-
Ensures
System.loadLibrary("lib") is present in the Kotlin plugin's
companion object init block for each cpp module lib.
cpp modules use __attribute__((constructor)) for auto-registration, so
no JniBridge.register call is needed — just loading the .so is enough.
-
linkKotlinPlugin(String pluginName, List<Map<String, String>> modules, {String baseDir = '.'})
→ void
-
-
linkLinux(String pluginName, List<String> moduleLibs, String nitroNativePath, {String baseDir = '.', List<ModuleInfo>? moduleInfos})
→ void
-
-
linkMacosPodspec(String pluginName, List<String> moduleLibs, {String baseDir = '.', List<ModuleInfo>? moduleInfos})
→ void
-
-
linkMacosSwiftPlugin(String pluginName, List<Map<String, String>> modules, {String baseDir = '.'})
→ void
-
Wires non-cpp module registrations into the macOS Swift plugin file.
-
linkPodspec(String pluginName, List<String> moduleLibs, {String baseDir = '.', List<ModuleInfo>? moduleInfos})
→ void
-
-
linkSwiftPlugin(String pluginName, List<Map<String, String>> modules, {String baseDir = '.'})
→ void
-
-
linkWindows(String pluginName, List<String> moduleLibs, String nitroNativePath, {String baseDir = '.', List<ModuleInfo>? moduleInfos})
→ void
-
-
linkWindowsCppImplStubs(List<ModuleInfo> moduleInfos, {String baseDir = '.'})
→ void
-
Creates Windows-specific C++ impl stub files for modules that target
windows: WindowsNativeImpl.cpp. These stubs live in windows/src/ so
windows/CMakeLists.txt can reference them via a relative path.
-
nitroNativePathExists(String cmakeNitroNative, String srcDir)
→ bool
-
-
purgeStaleCppKotlinRegistrations(List<ModuleInfo> cppModules, {String baseDir = '.'})
→ void
-
Removes stale
<Module>JniBridge.register(...) calls from Plugin.kt for
modules that have been converted to NativeImpl.cpp.
-
purgeStaleCppSwiftRegistrations(List<ModuleInfo> cppModules, {String platform = 'ios', String baseDir = '.'})
→ void
-
Removes stale
<Module>Registry.register(...) calls from *Plugin.swift for
modules that have been converted to NativeImpl.cpp (AppleNativeImpl.cpp).
-
resolveNitroNativePath(String pluginDir)
→ String
-
Resolves the absolute path to the installed
nitro package's src/native
directory by reading .dart_tool/package_config.json inside pluginDir.