From 35fc89584f05472e17846770603313bbd9cf31d9 Mon Sep 17 00:00:00 2001 From: "Alexander \"PapaTutuWawa" Date: Tue, 25 Jan 2022 21:08:17 +0100 Subject: [PATCH] fix: result not known --- lib/moxdns.dart | 34 ++++++++++++++++++---------------- 1 file changed, 18 insertions(+), 16 deletions(-) diff --git a/lib/moxdns.dart b/lib/moxdns.dart index 9b90863..a7d2f31 100644 --- a/lib/moxdns.dart +++ b/lib/moxdns.dart @@ -18,25 +18,27 @@ class Moxdns { static Future> srvQuery(String domain, bool dnssec) async { try { final List results = await _channel.invokeMethod("srvQuery", [ domain, dnssec ]); + + final records = List.empty(growable: true); + for (var record in results) { + if (record == null) { + continue; + } + + final rr = Map.from(record); + records.add(SrvRecord( + target: rr["target"]!, + port: int.parse(rr["port"]!), + priority: int.parse(rr["priority"]!), + weight: int.parse(rr["weight"]!) + )); + } + + return records; } on PlatformException catch(e) { return const []; } - final records = List.empty(growable: true); - for (var record in results) { - if (record == null) { - continue; - } - - final rr = Map.from(record); - records.add(SrvRecord( - target: rr["target"]!, - port: int.parse(rr["port"]!), - priority: int.parse(rr["priority"]!), - weight: int.parse(rr["weight"]!) - )); - } - - return records; + return const []; } }