parse static method

HackerNewsItemUrl? parse(
  1. String url
)

Implementation

static HackerNewsItemUrl? parse(String url) {
  // cSpell: ignore ycombinator
  var matches = RegExp(
          r'(?:https?:)?\/\/news\.ycombinator\.com\/item\?id=(?<item>[0-9]+)')
      .allMatches(url);
  var id = matches.getValue("item");
  if (id == null) return null;
  return HackerNewsItemUrl._(id);
}