Binding Native Plugins with Flutter and Dart
summary
Compares method channels, FFI gen and JNI gen by measuring real code: sends 410KB JSON over method channel to show async latency, uses OpenCV ArUco detection as a practical workload, and benchmarks on Pixel 9 and iPhone 12 where FFI/JNI shave milliseconds off roundtrip time and give synchronous responses while classify CPU time stays similar. Describes memory arenas, JNI dollar overloads, callback patterns (send/receive ports, pointer_from_function, native_callable_listener), static linking pitfalls, and links to full GitHub source.
AI-written summary · about
chapters (12)
- 0:00Native plugin binding intro
- 1:25Why bind native plugins
- 3:14Method channels deep dive
- 6:25Beyond method channels with FFI/JNI
- 7:49OpenCV example and performance tests
- 9:15FFI gen setup for C
- 12:23JNI gen for Java/Kotlin
- 16:13Advantages and drawbacks of FFI and JNI
- 18:38Callbacks in native plugins
- 24:02Bluetooth LED demo with callbacks
- 26:51Choosing binding approach
- 28:21Q&A
related talks
36mFlutter Plugins - From Method Channels to Native Interop
31mSeamless Interoperability: Harnessing JNIGen and FFIGen
37mUsing Dart FFI for Compute-Heavy Tasks in Flutter Apps
37mUsing Dart FFI for Compute-Heavy Tasks
43mSummit Session 2 - Past, Present and Future of Native Interop
41mPlugins: Your Bridge to Native Code
28mAMA with Brian Egan and Filip Hracek
38mThe past, present, and future of native interop
