I am currently writing an app where the user needs to know the IP address of their phone/tablet. Where would I find this information?
I only want to know what the local IP address is, such as, 192.168.x.xxx and NOT the public IP address of the router.
So far, I can only seem to find InternetAddress.anyIPv4 and InternetAddress.loopbackIPv4. The loopback address is not what I want as it is 127.0.0.1.
解决方案
I guess you mean the local IP of the currently connected Wifi network, right?
EDIT: NetworkInterface.list is not supported in Android, as later pointed out by Mahesh. Aside from the wifi package suggested in his answer, there's a PR to bring that to the connectivity plugin.
You may also want to check if Wifi is available using the connectivity plugin in flutter/plugins.
Right below there's a simple example of usage of NetworkInferface. B