getConnectedLocalNetworkAddress static method
Implementation
static Future<String> getConnectedLocalNetworkAddress() async {
List<NetworkInterface> interfaces = await NetworkInterface.list(
includeLoopback: false, type: InternetAddressType.IPv4);
String result = INSPECTOR_DEFAULT_ADDRESS;
for (NetworkInterface interface in interfaces) {
if (interface.name == 'en0' || interface.name == 'eth0' || interface.name == 'wlan0') {
result = interface.addresses.first.address;
break;
}
}
return result;
}