matchTarget static method

Target? matchTarget(
  1. Uri uri
)

Implementation

static Target? matchTarget(Uri uri) => switch ((uri.pathSegments)) {
      [var type] => Target(type),
      [var type, var id] => ResourceTarget(type, id),
      [var type, var id, var rel] => RelatedTarget(type, id, rel),
      [var type, var id, 'relationships', var rel] =>
        RelationshipTarget(type, id, rel),
      _ => null
    };