Check if block is visible I'm on Drupal 8,

I'm using \Drupal::entityQuery('block') to get the list of blocks. 

Now I want to determine if the block is visible for:


Current Page (Content Type)
Current User (Role)
Current Path


I want this information according to visibility settings configured in block's configuration.

I can use $block-&gt;getVisibility() method when I load the block and there I can iterate through visibility settings and find out if the block is visible or not.

I wander if there is a better and easier way to do this??
Checking view access to a block includes visibility checks. so you can just do this: if ($block-&gt;access('view')).

Why do you want this information? block.module has a block.repository service with a getVisibleBlocksPerRegion() which gives you exactly that. a list of visible blocks, grouped by region.