Skip to content

Commit

Permalink
refactor: refactor initialization of CoapUDPChannel
Browse files Browse the repository at this point in the history
  • Loading branch information
JKRhb committed Mar 31, 2022
1 parent b7dc749 commit 1bc18fa
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions lib/src/channel/coap_udp_channel.dart
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,11 @@ part of coap;
class CoapUDPChannel extends CoapIChannel {
/// Initialise with a specific address and port
CoapUDPChannel(this._address, this._port, this.uriScheme,
{required String namespace, required this.config}) {
_eventBus = CoapEventBus(namespace: namespace);
final socket = CoapNetworkManagement.getNetwork(
address!, _port, CoapConstants.uriScheme,
namespace: namespace, config: config);
_socket = socket;
}
{required String namespace, required this.config})
: _eventBus = CoapEventBus(namespace: namespace),
_socket = CoapNetworkManagement.getNetwork(
_address!, _port, CoapConstants.uriScheme,
namespace: namespace, config: config);

final String uriScheme;

Expand All @@ -31,11 +29,11 @@ class CoapUDPChannel extends CoapIChannel {

@override
CoapInternetAddress? get address => _address;
late CoapINetwork _socket;
final CoapINetwork _socket;

final typed.Uint8Buffer _buff = typed.Uint8Buffer();

late final CoapEventBus _eventBus;
final CoapEventBus _eventBus;

@override
Future<void> start() async {
Expand Down

0 comments on commit 1bc18fa

Please sign in to comment.