getDeviceIpAddresses static method
Get all device IP addresses (for debugging and network discovery)
Implementation
static Future<List<String>> getDeviceIpAddresses() async {
final addresses = <String>[];
try {
final interfaces = await NetworkInterface.list();
for (final interface in interfaces) {
for (final address in interface.addresses) {
if (address.type == InternetAddressType.IPv4 &&
!address.isLoopback &&
!address.address.startsWith('169.254')) {
// Exclude link-local
addresses.add(address.address);
}
}
}
} catch (e) {
logw('Error getting device IPs: $e');
}
return addresses;
}