electrocardiogramQuery static method

Future<List<Electrocardiogram>> electrocardiogramQuery(
  1. Predicate predicate, {
  2. bool withVoltageMeasurements = false,
})

Returns Electrocardiogram samples for the provided time interval predicate predicate.

Implementation

static Future<List<Electrocardiogram>> electrocardiogramQuery(
    Predicate predicate,
    {bool withVoltageMeasurements = false}) async {
  final arguments = <String, dynamic>{
    'withVoltageMeasurements': withVoltageMeasurements,
  };
  arguments.addAll(predicate.map);
  final result =
      await _methodChannel.invokeMethod('electrocardiogramQuery', arguments);
  final List<dynamic> list = jsonDecode(result);
  final electrocardiograms = <Electrocardiogram>[];
  for (final Map<String, dynamic> map in list) {
    final electrocardiogram = Electrocardiogram.fromJson(map);
    electrocardiograms.add(electrocardiogram);
  }
  return electrocardiograms;
}