extractAndPostData method

Future<SpikeWebhookJobDetails> extractAndPostData(
  1. SpikeDataType<SpikeData<SpikeEntry>> type, {
  2. DateTime? from,
  3. DateTime? to,
})

Implementation

Future<SpikeWebhookJobDetails> extractAndPostData(
  SpikeDataType type, {
  DateTime? from,
  DateTime? to,
}) async {
  if (!Platform.isIOS && type == SpikeDataType.ecg) {
    return emptyEcgWebhook(from, to);
  }

  await ensurePermissionsAreGranted(types: [type]);

  final result = await NativeSDKBridge.extractAndPostData(
    connectionId: connectionId,
    dataType: type.toNativeDataType(),
    from: from,
    to: to,
  );

  ExceptionHandler.checkException(result);

  final object = jsonDecode(result);
  final jobDetails = SpikeWebhookJobDetails.fromObject(object);

  return jobDetails;
}