You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[pigeon] Stop binding HostApi interfaces with jnigen: they're unused and make up 35% of the .jni.dart file #193882
For each HostApi, pigeon asks jnigen to bind both the Kotlin interface (FooApi) and its Registrar (FooApiRegistrar). The generated Dart only ever calls the Registrar, so the interface's bindings are dead code. They are the single largest part of the generated .jni.dart file.
The generated Dart holds and calls only the Registrar (native_interop_tests.gen.dart L2707). Nothing in it references the bound HostApi interface.
The FlutterApi interface is different: Dart implements it, so its binding is needed and should stay.
Measurements
From pigeon's test plugin, regenerated with jnigen 1.0.1 and formatted at width 100:
Class list
.jni.dart lines
Today
40,948
Without the HostApi interface
25,507 (−37.7%)
The HostApi interface's bindings are 14,438 lines, 35.2% of the file.
Without it, jnigen emits a 6-line stub for the Registrar's supertype, and the Registrar's own bindings come out byte-identical.
The result passes the analyzer, and all 25 native interop probe calls pass in a release build.
Proposed fix
List only the Registrar for HostApis:
for (finalApi api in root.apis) {
if (api isAstHostApi) {
indent.writeln("'$packagePrefix${api.name}Registrar',");
} elseif (api isAstFlutterApi) {
indent.writeln("'$packagePrefix${api.name}',");
indent.writeln("'$packagePrefix${api.name}Registrar',");
}
}
The Kotlin interface stays as it is: the Registrar implements it, and users implement it. Only its Dart binding goes away. This is a patch-level change; plugins pick it up the next time they regenerate.
Benefits: smaller generated Dart (faster analysis, less code to ship and review) and less work for jnigen. No API or behavior change.
This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v and a minimal reproduction of the issue.
Activity
[pigeon] Replace full JNI bindings with stubs for API classes that ar…
github-actions commentedon Oct 29, 2026
This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of
flutter doctor -vand a minimal reproduction of the issue.