fromDomain static method

Future<StellarToml> fromDomain(
  1. String domain, {
  2. Client? httpClient,
})

Implementation

static Future<StellarToml> fromDomain(String domain,
    {http.Client? httpClient}) async {
  Uri uri = Uri.parse("https://" + domain + "/.well-known/stellar.toml");
  http.Client client = httpClient == null ? http.Client() : httpClient;
  return await client
      .get(uri, headers: RequestBuilder.headers)
      .then((response) {
    if (response.statusCode != 200) {
      throw Exception(
          "Stellar toml not found, response status code ${response.statusCode}");
    }
    return new StellarToml(response.body);
  });
}