saveMeasurement method

Future<Channels?> saveMeasurement({
  1. ModuleType type = ModuleType.ecg,
})

Implementation

Future<Channels?> saveMeasurement({ModuleType type = ModuleType.ecg}) async {
  if (type == ModuleType.ecg) {
    final lastChannel = module.ecg?.lastChannel;
    final dataFilter = module.ecg?.dataFilter;
    if (lastChannel == null) return null;
    return Channels.fromList(lastChannel.list.toList(), dataFilter);
  }

  if (type == ModuleType.oxi) {
    final lastChannel = module.oxi?.lastChannel;
    final dataFilter = module.oxi?.dataFilter;
    if (lastChannel == null) return null;
    return Channels.fromList(lastChannel.list.toList(), dataFilter);
  }

  return null;
}