fix: result not known
This commit is contained in:
parent
0543c7ab8a
commit
35fc89584f
@ -18,25 +18,27 @@ class Moxdns {
|
|||||||
static Future<List<SrvRecord>> srvQuery(String domain, bool dnssec) async {
|
static Future<List<SrvRecord>> srvQuery(String domain, bool dnssec) async {
|
||||||
try {
|
try {
|
||||||
final List<dynamic> results = await _channel.invokeMethod("srvQuery", [ domain, dnssec ]);
|
final List<dynamic> results = await _channel.invokeMethod("srvQuery", [ domain, dnssec ]);
|
||||||
|
|
||||||
|
final records = List<SrvRecord>.empty(growable: true);
|
||||||
|
for (var record in results) {
|
||||||
|
if (record == null) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
final rr = Map<String, String>.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) {
|
} on PlatformException catch(e) {
|
||||||
return const [];
|
return const [];
|
||||||
}
|
}
|
||||||
|
|
||||||
final records = List<SrvRecord>.empty(growable: true);
|
return const [];
|
||||||
for (var record in results) {
|
|
||||||
if (record == null) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
final rr = Map<String, String>.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;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user