get method

  1. @override
Resource get(
  1. Link link
)
override

Returns the Resource at the given link's HREF.

A Resource is always returned, since for some cases we can't know if it exists before actually fetching it, such as HTTP. Therefore, errors are handled at the Resource level.

Implementation

@override
Resource get(Link link) {
  Route? route = routes.firstOrNullWhere((it) => it.accepts(link));
  if (route != null) {
    return route.fetcher.get(link);
  }
  return FailureResource(link, ResourceException.notFound);
}