Adopting native assets for cross-platform FFI plugins
Status: Accepted
Interop with dart:ffi promises to make native libraries libraries available to apps without writing full-blown Flutter plugins or dealing with platform-specific build configurations. However, dart:ffi itself offers no mechanism to actually bundle native libraries with apps, requiring complex workarounds. Dart’s upcoming native assets feature fills this gap. This talk gives an overview of that feature and how it can be adopted by packages today. Key takeaways from this talk are:
- An overview of the new @Native interop style used to call C from Dart.
- How build hooks can be used to easily compile native code across platforms.
- Which steps package authors can take to adopt native assets without breaking users.
- Features to give users more control over their native dependencies.
The talk introduces necessary concepts, but assumes basic familiarity with dart:ffi and writing Flutter plugins.