uploadAppleHealthDataWithToken method

Future<bool> uploadAppleHealthDataWithToken(
  1. String token,
  2. String data
)

Implementation

Future<bool> uploadAppleHealthDataWithToken(
  String token,
  String data,
) async {
  try {
    final payload = {
      'externalUserId': 'NA',
      'data': [data]
    };
    await dio.post(
      '${Config.url}/custom-data/apple-health/upload-with-token',
      data: payload,
      options: Options(
        headers: {
          'Content-Type': 'application/json',
          'Accept': 'application/json',
          'Authorization': 'Bearer $token',
        },
      ),
    );

    return true;
  } catch (e) {
    return false;
  }
}