RelayInfo.fromJson constructor

RelayInfo.fromJson(
  1. Map json,
  2. String url
)

Implementation

factory RelayInfo.fromJson(Map<dynamic, dynamic> json, String url) {
  final String name = json["name"] ?? '';
  final String description = json["description"] ?? "";
  final String pubKey = json["pubkey"] ?? "";
  final String contact = json["contact"] ?? "";
  String icon;
  if (json["icon"] != null) {
    icon = json["icon"];
  } else {
    icon = "$url${url.endsWith("/") ? "" : "/"}favicon.ico";
  }
  final List<dynamic> nips = json["supported_nips"] ?? [];
  final String software = json["software"] ?? "";
  final String version = json["version"] ?? "";
  return RelayInfo._(
      name, description, pubKey, contact, nips, software, version, icon);
}