detectDomAdblocker property Null safety

bool detectDomAdblocker

Detect if an ad blocker is blocking ads in the DOM itself


bool get detectDomAdblocker {
  // that's a legacy Ad Block Plus check
  //  I don't think this attribute is set anymore, but I am keeping it anyway
  if (document.body?.getAttribute('abp') != null) {
    return true;

  // try to lure adblockers into a trap
  final bait = _helper.createBaitElement();
  final detected = _helper.doesElementIsBlocked(bait);

  return detected;