checkAtsign method

Future<bool> checkAtsign(
  1. String receiver, {
  2. String root = 'root.atsign.org',
})

checks receiver is a valid atsign

Implementation

Future<bool> checkAtsign(String receiver,
    {String root = 'root.atsign.org'}) async {
  // ignore: unnecessary_null_comparison
  if (receiver == null) {
    return false;
  } else if (!receiver.contains('@')) {
    receiver = '@$receiver';
  }
  var checkPresence = (await CacheableSecondaryAddressFinder(root, 64)
          .findSecondary(receiver))
      .toString();
  return checkPresence.isNotEmpty;
}