DartPythonBridge class

Handles booting the Python worker and routing calls over stdin/stdout.

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

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

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

Static Properties

handshake Map<String, dynamic>
Return the handshake payload received from the worker.
no setter
stderrStream Stream<String>
Listen to stderr lines emitted by the Python process.
no setter

Static Methods

call(String functionName, {List? positional, Map<String, dynamic>? named, Duration timeout = const Duration(seconds: 10)}) Future
Call a registered Python function by name, returning the result only.
callWithMeta(String functionName, {List? positional, Map<String, dynamic>? named, Duration timeout = const Duration(seconds: 10)}) Future<BridgeResult>
Call a registered Python function by name, returning the value and metadata.
dispose() Future<void>
Stop the worker process and clean up listeners.
init({String pythonExecutable = 'python', String scriptPath = 'dart_python_bridge/example_worker.py', Duration startupTimeout = const Duration(seconds: 5), Map<String, String>? environment, String? workingDirectory}) Future<void>
Start the Python worker process.
registerInboundAdapter(String type, dynamic decode(dynamic payload)) → void
Register a Python -> Dart adapter.
registerOutboundAdapter<T>(String type, dynamic encode(T value)) → void
Register a Dart -> Python adapter.