Skip to content

Commit

Permalink
feat: add static constructors for RelicAddress from hostname and Inte…
Browse files Browse the repository at this point in the history
…rnetAddress
  • Loading branch information
klkucaj committed Jan 3, 2025
1 parent b8e20da commit 243e40b
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions lib/src/address/relic_address.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,18 @@ import 'dart:io';
abstract class RelicAddress<T> {
/// Returns the address as an [Object].
T get address;

/// Creates a [RelicAddress] from a [String].
static RelicAddress<String> fromHostname(String hostname) {
return RelicHostnameAddress(hostname: hostname);
}

/// Creates a [RelicAddress] from an [InternetAddress].
static RelicAddress<InternetAddress> fromInternetAddress(
InternetAddress address,
) {
return RelicInternetAddress(internetAddress: address);
}
}

/// A class that represents a hostname address.
Expand Down

0 comments on commit 243e40b

Please sign in to comment.