sdk
sdk copied to clipboard
InternetAddress.reverse does not work on android
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)
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.
Since this works on Dart CLI (Dart native) and not in a Flutter app you should probably file this issue against Flutter.