NativeBindings class abstract

Abstract interface over the 17 native C functions.

Uses int handles (the pointer address) instead of Pointer<T> types so that the interface remains pure Dart and trivially mockable.

All memory management (C string allocation/deallocation, pointer lifecycle) is the responsibility of the concrete implementation.

Implementers

Constructors

NativeBindings()
Creates a NativeBindings.

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

Operators

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