sdk icon indicating copy to clipboard operation
sdk copied to clipboard

InternetAddress.reverse does not work on android

Open guyluz11 opened this issue 3 years ago • 2 comments

Running the following code work in dart native but does not work inside a flutter app

final InternetAddress? internetAddressTemp =
    InternetAddress.tryParse('Ip_with_host');
InternetAddress internetAddress = await internetAddressTemp!.reverse();
print(internetAddress.host);

Getting the following exception

E/flutter ( 2090): [ERROR:flutter/runtime/dart_isolate.cc(1098)] Unhandled exception:
E/flutter ( 2090): SocketException: Failed reverse host lookup (OS Error: hostname nor servname provided, or not known, errno = 8), address = 192.168.1.66
E/flutter ( 2090): #0      _NativeSocket.reverseLookup.<anonymous closure> (dart:io-patch/socket_patch.dart:531:9)

guyluz11 avatar Aug 06 '22 15:08 guyluz11

I can't reproduce on Flutter Linux

I guess it's an Android implementation or something with android permissions. My android app has the following permissions:

    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
    <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
    <uses-permission android:name="android.permission.INTERNET"/>

I can test it on Windows too if there is a need.

guyluz11 avatar Aug 07 '22 17:08 guyluz11

Since this works on Dart CLI (Dart native) and not in a Flutter app you should probably file this issue against Flutter.

a-siva avatar Aug 08 '22 16:08 a-siva