WooCommerce – Conditional for page created by rewrite_rule

In WordPress, the request path, e.g. path/to/something as in example.com/path/to/something?query=string&if=any, is saved in WP::$request which is accessible via the global $wp variable, so in your case, you can do so to check if the page is /dashboard/products:

global $wp;
// Note: No trailing slashes.
$is_my_page = ( 'dashboard/products' === $wp->request );

// Or without the "global $wp;"
$is_my_page = ( 'dashboard/products' === $GLOBALS['wp']->request );

// To check if you're on /dashboard/products/<anything>:
global $wp;
$is_my_page = preg_match( '#^dashboard/products/#', $wp->request );

And there might be a Dokan-specific way/API/function, but you will have to find that on your own.

UPDATE

If /dashboard/products is not actually a registered WordPress rewrite rule, or that you’re checking prior to WordPress parses the request URL, path, etc., then you can do “the PHP way” like so:

if ( ! empty( $_SERVER['REQUEST_URI'] ) ) {
    $path = parse_url( $_SERVER['REQUEST_URI'], PHP_URL_PATH );
    $is_my_page = ( '/dashboard/products/' === $path );
}