Support standalone target without requiring Flutter SDK
- Dominant language
- Dart
- Stars
- 275
- Forks
- 144
- Avg merge
- 2d 10h
- Merged PRs (30d)
- 47
Description
### Status Quo:
Flutter SDK is needed even if we are using `dart` command only - due to the way `package:jni` is packaged.
In theory it is possible to comment out flutter-specific parts and use the same module from standalone and flutter targets. But due to problems with `pub`, we are not able to do it. [pub#3563](https://github.com/dart-lang/pub/issues/3563).
There are 2 parts where we need the flutter features.
* The initialization plugin: `JniPlugin.Java`, android only.
* FFI asset bundling: `ffiPlugin: true` directive, all flutter targets.
### Proposed Design:
There should be 2 packages, `package:jni` and `package:flutter_jni_interface`
The latter doesn't need to be touched by user code, apart from being included in pubspec. Latter being a flutter-specific plugin, it handles initializing android JNI behind the scenes, or packaging the DLL.
### Open questions:
* This doesn't probably solve the FFI plugin packaging problem. - Because as I am aware, `ffiPlugin` expects native code at `src/`.
* Can `flutter_jni_interface` be nested in `package:jni`? This will change latter's native source path to `flutter_jni_interface/src`. But only our setup scripts need to be changed to accommodate this.
### Disadvantages:
* Flutter users will have to add 2 packages instead of 1.
cc: @dcharkes
Contributor guide
Assessment
This issue has not been assessed yet.