add<T> static method

Future<Wire<T>> add<T>(
  1. Object scope,
  2. String signal,
  3. WireListener<T> listener, {
  4. int replies = 0,
})

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

Implementation

static Future<Wire<T>> add<T>(Object scope, String signal, WireListener<T> listener, {int replies = 0}) async {
  final wire = Wire<T>(scope, signal, listener, replies);
  await _MIDDLEWARE_LAYER.onAdd(wire);
  attach(wire);
  return wire;
}