parse static method
Implementation
static MediumUserUrl? parse(String url) {
var matches =
RegExp(r'(?:https?:)?\/\/medium\.com\/@(?<username>[A-z0-9]+)(?:\?.*)?')
.allMatches(url);
var userName = matches.getValue("username");
if (userName != null) {
return MediumUserUrl._(null, userName);
} else {
matches = RegExp(
r'(?:https?:)?\/\/medium\.com\/u\/(?<user_id>[A-z0-9]+)(?:\?.*)')
.allMatches(url);
var id = matches.getValue("user_id");
if (id != null) return MediumUserUrl._(id, null);
}
return null;
}