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 []; } }