dostr_relay_url 0.1.0
dostr_relay_url: ^0.1.0 copied to clipboard
Normalization of Nostr relay urls, so two spellings of one relay compare equal, and a type for the normalized ones, in pure Dart.
example/dostr_relay_url_example.dart
import 'package:dostr_relay_url/dostr_relay_url.dart';
void main() {
print(
RelayUrl.tryParse('WSS://Relay.Primal.NET:443/'),
); // wss://relay.primal.net
print(RelayUrl.tryParse('https://relay.primal.net')); // null
print(
['wss://relay.ditto.pub/', 'not a url'].map(RelayUrl.tryParse).nonNulls,
);
print(RelayUrl.fromUserInput('relay.primal.net')); // wss://relay.primal.net
}