LEDs are sensitive to voltage. My guess is when on battery, the voltage is constant. When plugged in, the battery charger is cycling on and off when the battery reaches full charge causing a variation in voltage and resultant flickering.
Walt & Bonnie
2006 Monaco Camelot 40PAQ, Cummins 400 ISL
'16 Ford C-Max, Roadmaster BP, Sterling towbar