LayrzProtocolSocket constructor
LayrzProtocolSocket({
- required String ident,
- String password = '',
- required String server,
- LayrzProtocolVersion version = LayrzProtocolVersion.v2,
- BlackboxStoreCallback? onBlackboxStore,
- BlackboxFetchCallback? onBlackboxFetch,
Implementation
LayrzProtocolSocket({
required this.ident,
this.password = '',
required this.server,
this.version = LayrzProtocolVersion.v2,
this.onBlackboxStore,
this.onBlackboxFetch,
}) : assert(ident.isNotEmpty) {
if (server.contains(':')) {
_host = server.split(':')[0];
_port = int.tryParse(server.split(':')[1]) ?? 0;
if (_port <= 0) throw ArgumentError('The port should be a number and greater than 0');
} else {
throw ArgumentError('The server should contain the port');
}
}