get static method

Future<RelayInfo?> get(
  1. String url
)

Implementation

static Future<RelayInfo?> get(String url) async {
  Uri uri = Uri.parse(url).replace(scheme: 'https');
  try {
    final response = await http.get(uri,
      headers: {'Accept': 'application/nostr+json'},
    );
    final decodedResponse = jsonDecode(
        utf8.decode(response.bodyBytes)) as Map;
    return RelayInfo.fromJson(decodedResponse, uri.toString());
  } catch (e) {
    if (kDebugMode) {
      print(e);
    }
    return null;
  }
}