# jni 0.1.1

Library to access JNI from dart and flutter




## Installing
```
export PUB_HOSTED_URL=https://pub.mirror.p-hatan.ir
flutter pub add 'jni:0.1.1'
```
Published: 2022-09-22T08:27:41.671613Z
Expected archive SHA-256: 47000d71954b2667e612639ad16facf72b360e62aa255c53220ef66e323f9cd8

Available in cache; verification: upstream_checksum
## Direct dependencies
- args: ^2.3.1
- ffi: ^2.0.0
- package_config: ^2.1.0
- path: ^1.8.0
- plugin_platform_interface: ^2.0.2

## Package README (untrusted upstream documentation)
# jni (experimental module)

This is a utility library to access JNI from Dart / Flutter code, intended as a supplement for `jnigen` code generator, as well as provide the common base components (such as managing the JVM instance) to the code generated by `jnigen`.

This library contains:

* functions to access the JNIEnv and JavaVM variables from JNI, and wrapper functions to those provided by JNI. JNIEnv is exposed via `GlobalJniEnv` type which provides a thin abstraction over JNIEnv, so that it can be used from multiple threads.

* Functions to spawn a JVM on desktop platforms (`Jni.spawn`).

* Some Android-specific helpers (get application context and current activity references).

* `JniObject` class, which provides base class for classes generated by jnigen.

This is intended for one-off / debugging uses of JNI, as well as providing a base library for code generated by jnigen. 

__To generate type-safe bindings from Java libraries, use `jnigen`.__

## SDK Note
Dart standalone is supported, but due to some current limitations of the `pubspec` format, `dart` command must be from Flutter SDK and not dart SDK. See dart-lang/pub#3563.

## Version note
This library is at an early stage of development and we do not provide backwards compatibility of the API at this point.

## Documentation
The test/ directory contains files with comments explaining the basics of this module, and the example/ directory contains a flutter example which also touches some Android-specifics.

Using this library assumes some familiarity with JNI - it's threading model and object references, among other things.

## jnigen

This library is a part of `jnigen` - a 2022 GSoC project.

The broader aim of jnigen is making Java APIs accessible from dart in an idiomatic way.


## Changelog
## 0.1.0
* Initial version: Android and Linux support, JniObject API

## 0.1.1
* Windows support for running tests and examples on development machines.







 
