dart_monty_ffi 0.3.3
dart_monty_ffi: ^0.3.3 copied to clipboard
Native FFI backend for dart_monty — Dart/Flutter bindings for Monty, a Rust-built embeddable sandbox running a restricted subset of Python.
dart_monty_ffi #
Pure Dart native FFI implementation of dart_monty. Wraps the Rust libdart_monty_native shared library via dart:ffi, providing synchronous bindings to the Monty sandboxed Python interpreter.
This package has no Flutter dependency and can be used in CLI tools, server-side Dart, or any Dart project.
- Flutter apps should import
dart_montyinstead — the federated plugin selects the correct backend automatically. - Pure Dart projects (CLI, server) can depend on this package directly to run Python via the native Rust library.
Architecture #
Dart -> NativeBindingsFfi (dart:ffi)
-> DynamicLibrary.open(libdart_monty_native)
-> 17 extern "C" functions (Rust)
Key Classes #
| Class | Description |
|---|---|
NativeBindings |
Abstract interface over the 17 native C functions |
NativeBindingsFfi |
Concrete FFI implementation with pointer lifecycle management |
MontyFfi |
MontyPlatform implementation using NativeBindings |
NativeLibraryLoader |
Platform-aware library path resolution |
See the main dart_monty repository for full documentation.