check function
Implementation
Future<List<CheckedDomain>> check(String name,
{required List<String> tlds}) async {
final parameters = {
'tlds': tlds.join(','),
'hash': hash(name, 27).toString(),
};
final decoded = [
for (final response in await Future.wait([
'https://instantdomainsearch.com/services/zone-names/$name',
'https://instantdomainsearch.com/services/dns-names/$name',
].map((String address) => dio.get(address, queryParameters: parameters))))
if (response.data != null && response.data.isNotEmpty)
...response.data.trim().split('\n'),
].map((e) => jsonDecode(e));
return [
for (final check in decoded)
CheckedDomain(
name,
check['tld'],
status: switch (check['isRegistered']) {
true => CheckStatus.taken,
false => CheckStatus.available,
_ => CheckStatus.unknown,
},
)
];
}