CommunicationApi constructor

CommunicationApi(
  1. String executor,
  2. String id,
  3. bool isMaster,
  4. Declaration declaration, {
  5. String? statePath,
  6. StorageMapper mapper() = defaultStorageMapper,
  7. bool autoAcceptRegistration = true,
  8. bool ignoreMessageSignature = false,
})

Creates a CommunicationApi with the given executor and plugin id.

Whether this api isMaster and its privacy declaration must also be provided.

Implementation

CommunicationApi(this.executor, this.id, this.isMaster, this.declaration,
    {this.statePath,
    StorageMapper Function() mapper = defaultStorageMapper,
    this.autoAcceptRegistration = true,
    this.ignoreMessageSignature = false}) {
  _communicator = GeigerCommunicator(this);

  if (isMaster) {
    storage = GenericController(id, mapper());
    registerListener(
        [MessageType.storageEvent], StorageEventHandler(this, storage));
  } else {
    final controller = storage = PassthroughController(this);
    registerListener([MessageType.storageEvent], controller);
  }
}