parse static method

RedditUrl? parse(
  1. String url
)

Implementation

static RedditUrl? parse(String url) {
  var matches = RegExp(
          r'(?:https?:)?\/\/(?:[a-z]+\.)?reddit\.com\/(?:u(?:ser)?)\/(?<username>[A-z0-9\-\_]*)\/?')
      .allMatches(url);
  var username = matches.getValue("username");
  if (username == null) return null;
  return RedditUrl._(username);
}