Im trying to get the local ip address in a Flutter Web app. Searching the internet i came arround this package: get_ip 0.4.0 - it states it is working under web.
I have this function:
Future<void> initPlatformState() async {
print("Test");
String ipAddress;
// Platform messages may fail, so we use a try/catch PlatformException.
try {
ipAddress = await GetIp.ipAddress;
} on PlatformException {
ipAddress = 'Failed to get ipAddress.';
} on Exception {
print("Exception");
}
print("Ip: $ipAddress");
}
and i call it in initState of main.dart.
The console just has the output "Test", it does not output the ip or "Excemption".
Has someone allready used this package? Would there be an other way for a web app to get the local ip? Thanks for any help.
(I'm using MacOS)
Aucun commentaire:
Enregistrer un commentaire