WCSession.from constructor
WCSession.from(
- String wcUri
Implementation
factory WCSession.from(String wcUri) {
if (!wcUri.startsWith("wc:")) {
return WCSession.empty();
}
final uriString = wcUri.replaceAll("wc:", "wc://");
final uri = Uri.parse(uriString);
final bridge = uri.queryParameters["bridge"];
final key = uri.queryParameters["key"];
final topic = uri.userInfo;
final version = uri.host;
if (bridge == null || key == null) {
return WCSession.empty();
}
return WCSession(topic: topic, version: version, bridge: bridge, key: key);
}