ActiveHost constructor
ActiveHost({
- required InternetAddress internetAddress,
- List<
OpenPort> openPorts = const [], - String? macAddress,
- PingData? pingData,
- MdnsInfo? mdnsInfoVar,
Implementation
ActiveHost({
required this.internetAddress,
this.openPorts = const [],
String? macAddress,
PingData? pingData,
MdnsInfo? mdnsInfoVar,
}) {
_macAddress = macAddress;
final String tempAddress = internetAddress.address;
if (tempAddress.contains('.')) {
hostId = tempAddress.substring(
tempAddress.lastIndexOf('.') + 1,
tempAddress.length,
);
} else if (tempAddress.contains(':')) {
hostId = tempAddress.substring(
tempAddress.lastIndexOf(':') + 1,
tempAddress.length,
);
} else {
hostId = '-1';
}
pingData ??= getPingData(tempAddress);
_pingData = pingData;
hostName = setHostInfo();
// For some reason when internetAddress.host get called before the reverse
// there is weired value
weirdHostName = internetAddress.host;
if (mdnsInfoVar != null) {
mdnsInfo = Future.value(mdnsInfoVar);
} else {
mdnsInfo = setMdnsInfo();
}
deviceName = setDeviceName();
// fetch entry from in memory arp table
arpData = setARPData();
// fetch vendor from in memory vendor table
vendor = setVendor();
}