createCalibrationFinishedStatus function

CalibrationFinishedStatus createCalibrationFinishedStatus(
  1. dynamic payload
)

Implementation

CalibrationFinishedStatus createCalibrationFinishedStatus(payload) {
  final statusString = payload['status'];
  if (statusString == null) {
    throw Exception('Invalid payload at createCalibrationFinishedStatus.');
  }
  switch (statusString) {
    case 'success':
      return CalibrationFinishedStatus.success;
    case 'undo':
      return CalibrationFinishedStatus.undo;
    case 'cancelled':
      return CalibrationFinishedStatus.cancelled;
    default:
      throw Exception('Status $statusString not defined.');
  }
}