updateRadioBrowserApiUrls method
Implementation
Future<List<String>> updateRadioBrowserApiUrls() async {
// Get fastest ip of dns
String baseUrl = "all.api.radio-browser.info";
List<RRecord>? aRecs = await DnsUtils.lookupRecord(baseUrl, RRecordType.A, dnssec: false, provider: DnsApiProvider.GOOGLE);
if (aRecs == null) return [];
List<String> result = [];
for (var a in aRecs) {
var name = await DnsUtils.reverseDns(a.data);
if (name != null) {
var url = name.first.data;
result.add(url.substring(0, url.length - 1)); //remove end point
}
}
apiUrls = result;
return result;
}