getNextAdUnit method
✅ Get next available Ad Unit ID for a specific ad type (rotation logic)
Implementation
String? getNextAdUnit(String adType) {
if (_adsList.isEmpty) return null;
int startIndex = _currentAdIndex;
do {
final ad = _adsList[_currentAdIndex];
_currentAdIndex = (_currentAdIndex + 1) % _adsList.length;
if (ad.adsType == adType) {
return ad.adUnitId;
}
} while (_currentAdIndex != startIndex);
return null; // No matching ad type found
}