getAccelerationAtTimestamp method
Implementation
MovementValue getAccelerationAtTimestamp(DateTime time) {
if(_vectorList.isEmpty){
throw Exception("No List to get data from: Recording not started");
}
var timestamp = time.millisecondsSinceEpoch;
var exactElement = SensorVector4(x: 0, y: 0, z: 0, time: 0);
try {
exactElement = _vectorList.firstWhere((element) => element.time == timestamp);
} on StateError {
exactElement = _vectorList.firstWhere((element) => (element.time >= timestamp - inMillis) && element.time <= timestamp + inMillis);
}
return MovementTypeUtils.getHighestAccelerationValue(exactElement);
}