extractShortCode static method
Extracts the short code from a URL path
Short code is typically the last path component e.g., https://go.example.com/abc123 -> "abc123"
url: The URL to parse- Returns: Short code if found, null otherwise
Implementation
static String? extractShortCode(Uri url) {
final pathSegments = url.pathSegments.where((s) => s.isNotEmpty).toList();
return pathSegments.isNotEmpty ? pathSegments.last : null;
}