getDatum method
Subclasses should implement / override this method to collect the Datum.
This method will be called every time data has been buffered for a duration
and should return the final Datum for the buffered data.
Can return null
if no data is available.
Can return an ErrorDatum if an error occurs.
Implementation
@override
Future<Datum?> getDatum() async {
if (luxValues.isEmpty) return null;
Stats stats = Stats.fromData(luxValues);
return LightDatum(
meanLux: stats.average,
stdLux: stats.standardDeviation,
minLux: stats.min,
maxLux: stats.max);
}