Wire<T> class

Constructors

Wire(Object scope, String signal, WireListener<T> listener, [int replies = 0])
Wire object is a communication unit of the system, each instance associated with a signal

Properties

hashCode int
The hash code for this object.
no setterinherited
id int
no setter
replies int
getter/setter pair
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
scope Object
no setter
signal String
no setter
withReplies bool
no setter

Methods

clear() Future<void>
Nullify all relations
listenerEqual(WireListener listener) bool
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited
transfer(dynamic payload) Future
Call associated WireListener with data.

Operators

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

Static Methods

add<T>(Object scope, String signal, WireListener<T> listener, {int replies = 0}) Future<Wire<T>>
Create wire object from params and attach it to the communication layer All middleware will be informed from WireMiddleware.onAdd before wire is attached to the layer
addMany(Object scope, Map<String, WireListener> signalToHandlerMap) Future<List<Wire>>
Register many signals at once
attach(Wire wire) → void
data(String key, {dynamic value, WireDataGetter? getter}) WireData
Access to the data container, retrieve WireData object when value is null and set when is not WireData is a data container to changes of which anyone can subscribe/unsubscribe. It's associated with string key. WireData can't be null and Wire.data(key) will always return WireData instance. Initial value will be null and special property of WireData isSet equal to false until any value is set If value is null then delete method of WireData will be called, object will be removed from system To protect WireData from being set from unappropriated places the WireDataLockToken token introduced. When only specific object want have rights to write/change value of WireData it can create WireDataLockToken object and pass it to Wire.data method as option parameter token to validate the assign action. WireData API:
detach(Wire wire) Future<bool>
Remove wire object from communication layer, then inform all middlewares with Returns existence of another wires with that signal.
find<R>([R? instanceType]) → dynamic
Return an instance of an object by its type, throw an error in case it is not set
get<T>({String? signal, Object? scope, WireListener? listener, int? wireId}) List<Wire>
When you need Wires associated with signal or scope or listener Returns List<Wire>
has<T>({String? signal, Wire<T>? wire}) bool
Check if signal string or wire instance exists in communication layer
middleware(WireMiddleware value) → void
Class extending WireMiddleware can listen to all processes inside Wire
purge({bool? withMiddleware}) Future<void>
Remove all entities from Communication Layer and Data Container Layer @param withMiddleware used to remove all middleware
put<T>(T instance, {WireDataLockToken? lock}) → T
Store an instance of the object by it's type, and lock it, so it can't be overwritten
remove({String? signal, Object? scope, WireListener? listener}) Future<bool>
Remove all wires for specific signal, for more precise target to remove add scope and/or listener All middleware will be informed from WireMiddleware.onRemove after signal removed, only if existed Returns bool telling signal existed in communication layer
send<T>(String signal, {T? payload, Object? scope}) Future<WireSendResults>
Send signal through all wires has the signal string value Payload is optional, default is null, passed to WireListener from transfer If use scope then only wire with this scope value will receive the payload All middleware will be informed from WireMiddleware.onSend before signal sent on wires