Here, we have described how to check whether the current area is frontend or backend
Well, you can check it with object manager
$objectManager = MagentoFrameworkAppObjectManager::getInstance();
$areastate = $objectManager->get('MagentoFrameworkAppState');
echo $areastate->getAreaCode();
so it will show you that the current area is frontend or adminhtml

