NewYour coding agent can read the release notes before it upgrades.Set up the MCP server →
pub.dev · #140 most downloaded on pub.dev
A library to access JNI from Dart and Flutter that acts as a support library for package:jnigen.
Last release 9 days ago
01 Oct 2026
Ships fairly regularly
a new release about every 2 months
Nearly every release is documented
notes for 32 of 32 stable releases
3 versions withdrawn
withdrawn after publishing
4 years old
35 releases · first in 2022
One column per quarter.
Add deep conversion utilities for converting between Dart values and Java.
Fix JNI build errors on Linux arm64.
Revert an unnecessary (and breaking) KGP migration.
The YAML configuration format is deprecated and will be removed in a future release.
classes in the config file as a config errorpackage:package_config.Breaking Change: The Flutter specific APIs Jni.androidApplicationContext and Jni.androidActivity(int engineId) have been moved to a new package:jni_fl…
Jni.androidApplicationContext
and Jni.androidActivity(int engineId) have been moved to a new
package:jni_flutter. If you are using package:jni on Android you may need to
add this new package as a dependency.JList, JMap etc) are now direct code generated wrappers
around the Java objects, so are less Darty. Instead there are now Darty
adapter classes you can access via asDart().JType classes, only JType classes, and the JType
class is simplified.JType in many cases where it
used to be required.Jni.captureStackTraceOnRelease which defaults to false. When this is
set, the stack traces of the release points will be stored for JObjects to
help debug DoubleReleaseError and UseAfterReleaseErrors. This includes the
points where JObjects have been registered to be released by an arena via
JObject.releaseBy.JObject.releasedBy. It now does not throw a
DoubleReleaseError if the object was manually released before the end of
arena.JThrowable class which inherits from JObject and implements
Exception.JniException has been deleted. Java exceptions are now
thrown as JThrowable instead. JThrowable holds an actual Java exception,
instead of just holding a string message. It's a JObject, so the usual
.isA and .as methods work to cast the JThrowable to the underlying Java
exception.JBoolean, JByte, JCharacter, JDouble,
JFloat, JInteger, JLong, JNumber, JShort, and JString have changed
to be more consistent with other APIs. For example, JBoolean.booleanValue is
now JBoolean.toDartBool.Do not fail flutter build if JDK is not found for desktop.
flutter build if JDK is not found for desktop.Breaking Change: Removed the engineId argument from Jni.androidApplicationContext as the application context is not dependant on the engine ID.
engineId argument from
Jni.androidApplicationContext as the application context is not dependant on
the engine ID.Breaking Change: Made Jni.env internal.
Jni.env internal.JObjType to JType.Jni.getApplicationClassLoader(),
Jni.getCurrentActivity(), and Jni.getCachedApplicationContext(). Instead
use Jni.androidApplicationContext(engineId) to access the application
context and use Jni.androidActivity(engineId) to acccess the activity.Fixed a bug where certain method of JList, JSet, and JMap did not work with nullable elements.
JList, JSet, and JMap did not work
with nullable elements.JList.lastIndexOf.Updated bin/setup.dart to use Gradle instead of Maven for building Java sources. Added gradle executables and bootstrap jars #2003
bin/setup.dart to use Gradle instead of Maven for building Java
sources. Added gradle executables and bootstrap jars
#2003JObject.isInstanceOf which checks whether a JObject is an instance
of a java class.Added DynamicLibraryLoadError which is thrown when the dynamic library fails to load. HelperNotFoundError will only be thrown when the helper library
DynamicLibraryLoadError which is thrown when the dynamic library fails
to load. HelperNotFoundError will only be thrown when the helper library
cannot be found.dylibDir when running Jni.spawn from Dart standalone,
instead use the default value of build/jni_libs.JArray.of, which allows a JArray to be constructed from an
Iterable.JObject.isA, which checks whether a JObject is an instance of a java
typeclass.JByteArray.from, which allows a JByteArray to be constructed from an
Iterable<int>.Breaking Change: Separated primitive arrays from object arrays. Previously, a primitive array like an array of bytes was typed JArray . Now JArray onl…
Breaking Change: Separated primitive arrays from object arrays.
Previously, a primitive array like an array of bytes was typed
JArray<jbyte>. Now JArray<T> only accepts JObjects as types and
primitive arrays like arrays of bytes have their own types such as
JByteArray.
This enables all arrays to implement Iterable which makes it possible to use
them in a for-loop or use methods such as map on them.
Added nullable type classes for all Java objects.
Fixed a problem where interfaces implemented in Dart would crash when calling
the default object methods: equals, hashCode, and toString.
Added JniUtils.fromReferenceAddress which helps with sending JObjects through method channels. You can send the address of the pointer as long and rec
JniUtils.fromReferenceAddress which helps with sending JObjects
through method channels. You can send the address of the pointer as long and
reconstruct the class using the helper method.toString on a null object.Breaking Change: Renamed castTo to as.
castTo to as.internal_helpers_for_jnigen to _internal.JImplementer which enables building an object that implements multiple
Java interfaces.Breaking Change Removed Jni.accessors.
Jni.accessors.Jni.env methods into leaf functions to speed up their execution.kotlin_gradle_plugin.Fixed an issue with JObject.castTo where the type checking could fail in debug mode.
JObject.castTo where the type checking could fail in
debug mode.package:dart_flutter_team_lints.Nothing published for this version
Added lifetime event handling for the thread-local JNI env. Now jvm.DetachNativeThread is called when the thread detaches as recommended here.
jvm.DetachNativeThread is called when the thread detaches as recommended
here.JValueChar.fromString constructor.- Bumped minSdk to 21.
minSdk to 21.Fixed compilation on macOS for consumers that don't use JNI on macOS (which is still not supported) (#1122).
Breaking Change (#1004): Changed the return type operator [] of JArray to int instead of String. Similarly, change the argument type of operator []= t…
operator [] of JArray<jchar> to int instead of String. Similarly,
change the argument type of operator []= to accept int.getRange method to JArray of primitive types that returns a
TypedData list depending on the kind of the array.JArray's setRange and operator []=.Breaking Change (#548): Converted various Exceptions into Errors:
Breaking Change (#981):
JObject.reference now returns a JReference instead of Pointer<Void>.
.fromRef constructors are now called .fromReference and they take a
JReference instead of Pointer<Void>.
JObject reflective field retrieving and method calling methods are
removed. Use JClass API instead.
The following Jni.accessors methods have been removed:
getClassOfgetMethodIDOfgetStaticMethodIDOfgetFieldIDOfgetStaticFieldIDOfnewObjectWithArgscallMethodWithArgscallStaticMethodWithArgsInstead use the JClass API.
Jni.findJClass is replaced with JClass.forName(String name)
JClass has been refactored. Instead of directly calling methods, getting
and setting fields, use JClass.instanceMethodId, JClass.staticMethodId,
JClass.constructorId, JClass.instanceFieldId, and JClass.staticFieldId
to first get access to the member.
Renamed JObject.getClass() to JObject.jClass.
Removed Jni.deleteAllRefs.
Breaking Change (#548):
Converted various Exceptions into Errors:
UseAfterReleaseException -> UseAfterReleaseErrorDoubleReleaseException -> DoubleReleaseErrorSpawnException -> JniError (It's now a sealed class)JNullException -> JNullErrorInvalidCallTypeException -> InvalidCallTypeErrorHelperNotFoundException -> HelperNotFoundErrorJvmExistsException -> JniVmExistsErrorNoJvmInstanceException -> NoJvmInstanceErrorBreaking Change: Removed InvalidJStringException.
Breaking Change: JType is now sealed.
Breaking Change: Primitive types and their type classes are now final.
Breaking Change: JArray.filled now uses the generated type class of the
fill object and not its Java runtime type.
JObjects now check the types using instanceof in debug mode when using
castTo.
Breaking Change: Jni.initDLApi() is removed.
Added the ability to share JObjects across isolates.
// This now works.
final foo = 'foo'.toJString();
Isolate.run(() {
// `foo` is usable from another isolate.
print(foo);
});
Fixed a bug where get(Static)MethodID and get(Static)FieldID could access null and throw.
get(Static)MethodID and get(Static)FieldID could access
null and throw.Fixed a bug where reading non-null terminated strings would overflow.
package:dart_flutter_team_lints.Removed macOS Flutter plugin until package:jni supports it (#780).
Breaking Change (#563): Added JBuffer and JByteBuffer classes as default classes for java.nio.Buffer and java.nio.ByteBuffer respectively.
JBuffer and JByteBuffer classes as default classes for
java.nio.Buffer and java.nio.ByteBuffer respectively.final.addAll, removeAll and retainAll in JSet would run
their respective operation twice.JList.insertAll would not throw the potentially thrown
Java exception.Depend on the stable version of Dart 3.1.
Breaking Change (#707): Renamed delete* to release*.
delete* to release*.PortProxy and related methods used for interface implementation.java.lang.Character.Breaking Change (#711): Java primitive types are now all lowercase like jint, jshort, ...
jint, jshort, ...java.util.Set, java.util.Map, java.util.List and the
numeric types like java.lang.Integer, java.lang.Boolean, ... are now
included in package:jni.Type classes now have superCount and superType getters used for type inference.
superCount and superType getters used for type
inference.Fix extensions of nested types to use fully qualified generated wrapper names.
PortContinuation used for suspend fun in Kotlin.dartjni now depends on dart_api_dl.h.- Added .clang-format to pub.
.clang-format to pub.Bump ffigen and swift2objc versions.
JniX turned into JX for a more terse code.Windows support for running tests and examples on development machines.
Initial version: Android and Linux support, JObject API
Your coding agent can read these notes before it upgrades. Set up the MCP server →