https://github.com/nativeshell/flutter_engine_context
Easy access to FlutterView, FlutterBinaryMessenger and FlutterTextureRegistry for FFI.
https://github.com/nativeshell/flutter_engine_context
Last synced: 2 months ago
JSON representation
Easy access to FlutterView, FlutterBinaryMessenger and FlutterTextureRegistry for FFI.
- Host: GitHub
- URL: https://github.com/nativeshell/flutter_engine_context
- Owner: nativeshell
- License: mit
- Created: 2022-11-03T17:45:44.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2022-11-04T10:12:49.000Z (over 3 years ago)
- Last Synced: 2025-01-01T02:42:51.159Z (over 1 year ago)
- Language: Rust
- Homepage:
- Size: 43 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# flutter_engine_context
Flutter plugin that provides access to Flutter engine components (like view or texture registrar) from native code.
## Example
Dart code:
```dart
final handle = await FlutterEngineContext.instance.getEngineHandle();
// pass the handle native code (i.e. through FFI).
nativeMethod(handle);
```
Rust code:
```rust
let context = FlutterEngineContext::new();
let flutter_view = context.get_flutter_view(handle);
let texture_registry = contet.get_texture_registry(handle);
```
Rust code for Android:
```rust
let context = FlutterEngineContext::new(&jni_env, class_loader);
let flutter_view = context.get_flutter_view(handle);
let texture_registry = contet.get_texture_registry(handle);
```
On Android the `FlutterEngineContext` needs to be initialized with JNI environment and class loader used to load Flutter plugin (or application code).