getAddressByName method

Future<String?> getAddressByName(
  1. String name
)

Returns the target account address for the given name

Implementation

Future<String?> getAddressByName(String name) async {
 final match = namePattern.firstMatch(name);
 if (match == null || match.groupCount == 0) return null;
 final domain = match.namedGroup("domain");
 if (domain == null) return null;
 final subdomain = match.namedGroup("subdomain");
 final registration = subdomain != null
   ? await getRegistrationForSubdomainName(domain, subdomain)
   : await getRegistrationForDomainName(domain);
 return registration?.$1;
  }