I have a route object (which may not be the current route’s object) and I need to get the route’s name, e.g. entity.node.canonical. I don’t see any method to get the name directly from the object, nor do I see it anywhere when I inspect the object via Xdebug.
I know that I can easily get the name of the current route with
$current_route_name = Drupal::routeMatch()->getRouteName(), but how can I get the name of an arbitrary route, if I have the route object.