CoapClient constructor

CoapClient(
  1. Uri baseUri, {
  2. InternetAddressType addressType = InternetAddressType.any,
  3. InternetAddress? bindAddress,
  4. PskCredentialsCallback? pskCredentialsCallback,
  5. DefaultCoapConfig? config,
})

Instantiates. A supplied request is optional depending on the API call being used. If it is specified it will be prepared and used. Note that the host name part of the URI can be a name or an IP address, in which case it is not resolved.

You can define a custom config for the creation of a CoapClient. If no config is provided, then an instance of the CoapConfigDefault class will be used instead.

Implementation

CoapClient(
  this.baseUri, {
  this.addressType = InternetAddressType.any,
  this.bindAddress,
  final PskCredentialsCallback? pskCredentialsCallback,
  final DefaultCoapConfig? config,
})  : _config = config ?? CoapConfigDefault(),
      _pskCredentialsCallback = pskCredentialsCallback {
  _eventBus = CoapEventBus(namespace: hashCode.toString());
}