Access check on URL by route name

Check if the current user has access to a URL by route name.


$has_access = Url::fromRoute('route.name')->access()