Utilities to spawn and manage JNI.
- Available extensions
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
getJavaVM(
) → Pointer< JavaVM> - Returns pointer to current JNI JavaVM instance
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Properties
- env → GlobalJniEnv
-
Points to a process-wide shared instance of GlobalJniEnv.
final
Static Methods
-
findClass(
String name) → JClassPtr -
Finds the class from its
name
. -
getApplicationClassLoader(
) → JReference - Get the initial classLoader of the application.
-
getCachedApplicationContext(
) → JReference - Returns current application context on Android.
-
getCurrentActivity(
) → JReference - Returns current activity.
-
setDylibDir(
{required String dylibDir}) → void - Sets the directory where dynamic libraries are looked for. On dart standalone, call this in new isolate before doing any JNI operation.
-
spawn(
{String? dylibDir, List< String> jvmOptions = const [], List<String> classPath = const [], bool ignoreUnrecognized = false, int jniVersion = JniVersions.JNI_VERSION_1_6}) → void - Spawn an instance of JVM using JNI. This method should be called at the beginning of the program with appropriate options, before other isolates are spawned.
-
spawnIfNotExists(
{String? dylibDir, List< String> jvmOptions = const [], List<String> classPath = const [], bool ignoreUnrecognized = false, int jniVersion = JniVersions.JNI_VERSION_1_6}) → bool - Same as spawn but if a JVM exists, returns silently instead of throwing JniVmExistsError.
-
throwException(
JThrowablePtr exception) → void - Throws an exception.