Native Interop
Crossing from Dart into the host platform: channels, Pigeon codegen, dart:ffi, federated plugins, platform views and add-to-app. Interviewers ask because every app meets an API Flutter does not wrap.
part ofFlutteroverview, primer and where to startread it →on this pageshowhide
explore
- Method & Event Channels5 questions
- Pigeon Codegen5 questions
- FFI Bindings5 questions
- Federated Plugins6 questions
- Hosted Platform Views5 questions
- Add-to-App Embedding4 questions
- App States & Permissions6 questions
questions
page 2 of 2Since Flutter 3.44 turned Swift Package Manager on by default, what must a Flutter plugin ship for iOS and macOS, and what happens to plugins with only a podspec?
basics
~20 sA plugin should ship a Swift package (Package.swift with a Sources folder under ios, macos or darwin) and keep its podspec. Apps fall back to CocoaPods for plugins lacking Swift Package Manager support, which keeps them working but mixes two dependency managers.
In Flutter, what does flutter create --template=package_ffi set up, and how do its build hook and ffigen config deliver a C library to the app?
basics
~20 spackage_ffi creates a package with C sources, a hook/build.dart that compiles them into a code asset with native_toolchain_c, and an ffigen.yaml that generates @Native bindings resolved against that asset, with no Gradle, CMake or podspec files.
In Flutter add-to-app, how does FlutterEngineGroup reduce the memory and startup cost of several Flutter screens, and what stays separate between its engines?
basics
~20 sEngines spawned from one FlutterEngineGroup share reusable resources — GPU context, font metrics and the isolate group snapshot — so each extra instance costs about 180 kB and starts faster. Each engine still runs its own isolate with separate Dart state.
In Pigeon for Flutter, how does an @EventChannelApi definition stream scanned barcodes from Kotlin or Swift to Dart, and what does it generate?
basics
~20 sAn @EventChannelApi abstract class declares methods whose return type is the streamed element; Pigeon generates a Dart function returning Stream of that type and, on Kotlin and Swift, a stream-handler base class with onListen, a typed PigeonEventSink, and a register function.
In Flutter on iOS, how does a UiKitView platform view compose with Flutter content, and which composition limits should you expect?
basics
~20 sOn iOS, Flutter uses only hybrid composition: the native UIView is added to the view hierarchy and Flutter content is layered around it. ShaderMask and ColorFiltered do not apply to the native view, and BackdropFilter works only with limitations.
Your Flutter app must read a Bluetooth thermometer on Android, iOS and web: how do you decide between adopting an existing plugin, extending it, or writing your own federated plugin?
basics
~20 sAdopt when an existing plugin covers every target platform with active maintenance; fill a single missing platform with your own implementing package rather than a fork; write your own federated plugin only when a vendor SDK, protocol or roadmap no public plugin can serve forces it.
showing 31–36 of 36