fromDomain method Null safety

Future<WebAuth> fromDomain(
  1. String domain,
  2. Network network,
  3. {Client? httpClient}
)

Creates a WebAuth instance by loading the needed data from the stellar.toml file hosted on the given domain. e.g. fromDomain("soneso.com", Network.TESTNET)

  • Parameter domain: The domain from which to get the stellar information
  • Parameter network: The network used.

Implementation

static Future<WebAuth> fromDomain(
  String domain,
  Network network, {
  http.Client? httpClient,
}) async {
  final StellarToml toml = await StellarToml.fromDomain(
    domain,
    httpClient: httpClient,
  );

  if (toml.generalInformation.webAuthEndpoint == null) {
    throw Exception("No WEB_AUTH_ENDPOINT found in stellar.toml");
  }
  if (toml.generalInformation.signingKey == null) {
    throw Exception("No auth server SIGNING_KEY found in stellar.toml");
  }

  return new WebAuth(toml.generalInformation.webAuthEndpoint, network,
      toml.generalInformation.signingKey, domain);
}