From 53c56e6bd443d712616df060d824176833c600ec Mon Sep 17 00:00:00 2001 From: NaiJi Date: Mon, 5 Jun 2023 12:14:54 -0300 Subject: [PATCH] feat: Remove basic_utils dependency Replace it with InternetAddress from dart:io --- .../server_installation_repository.dart | 16 +++++++++------- pubspec.lock | 8 -------- pubspec.yaml | 1 - 3 files changed, 9 insertions(+), 16 deletions(-) diff --git a/lib/logic/cubit/server_installation/server_installation_repository.dart b/lib/logic/cubit/server_installation/server_installation_repository.dart index b3b80b3f..c138a340 100644 --- a/lib/logic/cubit/server_installation/server_installation_repository.dart +++ b/lib/logic/cubit/server_installation/server_installation_repository.dart @@ -1,6 +1,5 @@ import 'dart:io'; -import 'package:basic_utils/basic_utils.dart'; import 'package:device_info_plus/device_info_plus.dart'; import 'package:dio/dio.dart'; import 'package:easy_localization/easy_localization.dart'; @@ -451,15 +450,18 @@ class ServerInstallationRepository { } Future getServerIpFromDomain(final ServerDomain serverDomain) async { - final List? lookup = await DnsUtils.lookupRecord( - serverDomain.domainName, - RRecordType.A, - provider: DnsApiProvider.CLOUDFLARE, + String? domain; + await InternetAddress.lookup(serverDomain.domainName).then( + (final records) { + for (final record in records) { + domain = record.address; + } + }, ); - if (lookup == null || lookup.isEmpty) { + if (domain == null || domain!.isEmpty) { throw IpNotFoundException('No IP found for domain $serverDomain'); } - return lookup[0].data; + return domain!; } Future getDeviceName() async { diff --git a/pubspec.lock b/pubspec.lock index bd81200b..d812a890 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -73,14 +73,6 @@ packages: url: "https://pub.dev" source: hosted version: "3.0.0" - basic_utils: - dependency: "direct main" - description: - name: basic_utils - sha256: "8815477fcf58499e42326bd858e391442425fa57db9a45e48e15224c62049262" - url: "https://pub.dev" - source: hosted - version: "5.5.4" bloc: dependency: transitive description: diff --git a/pubspec.yaml b/pubspec.yaml index b0554aba..4e5e35d7 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -11,7 +11,6 @@ dependencies: animations: ^2.0.7 auto_route: ^7.3.2 auto_size_text: ^3.0.0 - basic_utils: ^5.5.4 crypt: ^4.3.0 cubit_form: ^2.0.1 device_info_plus: ^9.0.2