Plugin interface for main-thread components that interact with worker.
Plugins are initialized after worker creation and disposed before worker shutdown.
Use WorkerChannel via the worker handle for custom message passing.
Example: Authentication bridge that forwards credentials to worker
class AuthPlugin implements WorkerPlugin {
final Auth _auth;
final LocordaWorker _worker;
AuthPlugin(this._auth, this._worker);
@override
Future<void> initialize() async {
_auth.onStateChange.listen((state) {
_worker.sendMessage({'auth': state.toJson()});
});
}
@override
Future<void> dispose() async {
// Clean up listeners
}
}
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
-
dispose(
) → Future< void> - Clean up plugin resources before worker shutdown.
-
initialize(
) → Future< void> - Initialize plugin after worker is ready.
-
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