FfiCoreBindings class

Adapts NativeBindings (sync, int handles, RunResult/ProgressResult) to the MontyCoreBindings interface (async, CoreRunResult/ CoreProgressResult).

Owns the handle lifecycle internally — callers never see the raw int handle. Translation methods extract JSON from the FFI result structs and map them to the core intermediate types that BaseMontyPlatform consumes.

final bindings = FfiCoreBindings(bindings: NativeBindingsFfi());
final monty = MontyFfi(bindings: bindings);

Constructors

FfiCoreBindings({required NativeBindings bindings, void onHandleCreated(int handleId)?})
Creates an FfiCoreBindings backed by bindings.

Properties

handleId int?
The handle ID, available after run or start calls create().
no setter
hashCode int
The hash code for this object.
no setterinherited
onHandleCreated → void Function(int handleId)?
Optional callback invoked after a handle is created, before blocking execution begins.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

cancel() Future<void>
Cancel the current execution. Idempotent.
dispose() Future<void>
Releases all resources held by this bindings instance.
init() Future<bool>
Initializes the backend (Isolate, Worker, etc.).
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
resolveFutures(String resultsJson, String errorsJson) Future<CoreProgressResult>
Resolves pending futures with resultsJson and optional errorsJson.
restoreSnapshot(Uint8List data) Future<void>
Restores execution state from data.
resume(String valueJson) Future<CoreProgressResult>
Resumes execution with valueJson as the return value.
resumeAsFuture() Future<CoreProgressResult>
Resumes execution, converting the pending call into a future.
resumeWithError(String errorMessage) Future<CoreProgressResult>
Resumes execution, injecting errorMessage as a Python exception.
run(String code, {String? limitsJson, String? scriptName}) Future<CoreRunResult>
Runs code to completion and returns the result.
snapshot() Future<Uint8List>
Captures the current execution state as a snapshot.
start(String code, {String? extFnsJson, String? limitsJson, String? scriptName}) Future<CoreProgressResult>
Starts iterative execution of code with optional external functions.
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited