toUrl method

  1. @override
UrlData toUrl()
override

Implementation

@override
UrlData toUrl() {
  if (urlParser case final parser?) {
    final url = parser.encode(value);

    if (next case final next?) {
      return url.followedBy(next.toUrl());
    }

    return url;
  } else {
    throw HyperError(
        "Couldn't create url segment for $T. Please, provide a urlParser");
  }
}