How to get device IP in Dart/Flutter

前端 未结 8 819
孤城傲影
孤城傲影 2021-02-13 21:01

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

8条回答
  •  执笔经年
    2021-02-13 21:38

    In my recent app I have a requirement to get user's Ip address and then I found this packgage useful. https://pub.dev/packages/get_ip

    Here is How I use it.

    _onLoginButtonPressed() async {
    String ipAddress = await GetIp.ipAddress;
    print(ipAddress); //192.168.232.2
    }
    

提交回复
热议问题