isExistingAtsign method

Future<bool> isExistingAtsign(
  1. String? atsign
)

Implementation

Future<bool> isExistingAtsign(String? atsign) async {
  if (atsign == null) {
    return false;
  }
  atsign = formatAtSign(atsign);
  List<String> atSignsList = await getAtsignList();
  ServerStatus? status = await checkAtSignServerStatus(atsign!).timeout(
      Duration(seconds: AtOnboardingConstants.responseTimeLimit),
      onTimeout: () => throw AtOnboardingResponseStatus.timeOut);
  bool isExist =
      atSignsList.isNotEmpty ? atSignsList.contains(atsign) : false;
  if (status == ServerStatus.teapot) {
    isExist = false;
  }
  return isExist;
}