addReading method
- Timestamp timestamp,
- double value
Adds a new SensorReading with timestamp
relative to firstTimestamp.
Implementation
void addReading(Timestamp timestamp, double value) {
firstTimestamp ??= timestamp;
readings.add(SensorReading(time: timestamp - firstTimestamp!, value: value));
if (min == null || value < min!) min = value;
if (max == null || value > max!) max = value;
sum += value;
average = sum / readings.length;
}