NativeBindingsFfi class

Real FFI implementation of NativeBindings.

Uses @Native annotations via the generated bindings — symbol resolution is handled automatically by the Dart native assets system.

Inheritance

Constructors

NativeBindingsFfi()
Creates NativeBindingsFfi.

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

cancel(int handle) → void
Cancel the interpreter. Sets atomic cancel flag. Idempotent. No-op if handle is 0.
override
cancelById(int handleId) bool
Cancel by registry ID. Returns true if found and cancelled.
override
create(String code, {String? externalFunctions, String? scriptName}) int
Creates a handle from Python code.
override
free(int handle) → void
Frees the handle at handle. Safe to call with 0.
override
freeById(int handleId) bool
Free a handle by its registry ID. Returns true if found and freed.
override
getHandleId(int handle) int
Get the monotonic handle ID for cross-isolate cancel. Returns 0 if handle is invalid.
override
isCancelled(int handle) bool
Check if the cancel flag is set. Returns true if cancelled, false if not, or throws if handle invalid.
override
isCancelledById(int handleId) bool?
Check if cancelled by registry ID. Returns null if handle not found, true if cancelled, false if not.
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
resetCancel(int handle) → void
Reset the cancel flag. Only valid after cancel (v2 — rarely needed). No-op if handle is 0.
override
resolveFutures(int handle, String resultsJson, String errorsJson) ProgressResult
Resolves pending futures with resultsJson and errorsJson.
override
restore(Uint8List data) int
Restores a handle from snapshot data.
override
resume(int handle, String valueJson) ProgressResult
Resumes with a JSON-encoded return valueJson.
override
resumeAsFuture(int handle) ProgressResult
Resumes by creating a future for the pending call.
override
resumeWithError(int handle, String errorMessage) ProgressResult
Resumes with an errorMessage (raises RuntimeError in Python).
override
run(int handle) RunResult
Runs the handle to completion.
override
setMemoryLimit(int handle, int bytes) → void
Sets the memory limit in bytes.
override
setStackLimit(int handle, int depth) → void
Sets the stack depth limit.
override
setTimeLimitMs(int handle, int ms) → void
Sets the execution time limit in milliseconds.
override
snapshot(int handle) Uint8List
Serializes the handle state to a byte buffer (snapshot).
override
start(int handle) ProgressResult
Starts iterative execution. Returns progress with accessor data already populated.
override
toString() String
A string representation of this object.
inherited

Operators

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

Static Properties

instanceOrNull NativeBindingsFfi?
Nullable accessor for cancelById callers that check initialization.
no setter

Static Methods

ensureInitialized([String? libraryPath]) → void
Ensure the FFI library is loaded in the current isolate. Must be called before static cancel operations. Safe to call multiple times (idempotent, first-write-wins).