Every mobile codebase eventually meets the vendor SDK: a binary XCFramework for iOS, an AAR for Android, a licence agreement, and zero source. The naive integration - drop the blobs into the repo - breaks in three ways: your repo bloats, CI machines without the license fail, and every fresh checkout starts with a scavenger hunt.
Make the binary optional at build time
The pattern that works: wrap the SDK as a Swift package and a Gradle module whose binary dependency is optional. When the blob is absent, the wrapper compiles a stub that throws a clear error at runtime instead of failing the build.
// build.gradle.kts - vendor module
val vendorAar = file("libs/vendor-sdk.aar")
dependencies {
if (vendorAar.exists()) {
implementation(files(vendorAar))
} // else: stub source set compiles instead
}On iOS, the same idea in the plugin’s podspec: only add s.vendored_frameworks when the XCFramework is present (or a conditional binaryTarget in Package.swift if you have opted into Flutter’s still-experimental SwiftPM support), with a stubbed protocol implementation otherwise.
Why this matters more than it looks
- CI builds green without the vendor license on every runner.
- A fresh clone builds in minutes.
- The Flutter plugin layer stays identical; only the platform module swaps stub/real.
One trick, and every checkout builds. It is not a feature users ever see, but it removes a cost nobody has to keep paying.