Skip to content

Converte o DNS para o IP correspondente #6

Discussion options

You must be logged in to vote

A classe InternetAddress do dart:io tem o metodo estatico lookup que resolve dominios em IPs.

Exemplo main.dart:

import 'dart:io';

void main() async {
  final ips = await InternetAddress.lookup('google.com');
  
  print(ips);
}
$ dart main.dart
[InternetAddress('142.250.78.238', IPv4), InternetAddress('2800:3f0:4004:802::200e', IPv6)]

Voce pode tentar fazer o lookup antes de mandar o ip para o internet_connection_checker

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@paulobreim
Comment options

@seadramdesenv
Comment options

@seadramdesenv
Comment options

Answer selected by seadramdesenv
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
3 participants