carp_health_package 1.3.0+1 copy "carp_health_package: ^1.3.0+1" to clipboard
carp_health_package: ^1.3.0+1 copied to clipboard

outdated

CARP health sampling package. Samples health data from Apple Health or Google Fit.

example/lib/main.dart

import 'package:carp_health_package/health_package.dart';
import 'package:carp_mobile_sensing/carp_mobile_sensing.dart';
import 'package:health/health.dart';

/// This is a very simple example of how this sampling package is used with CARP Mobile Sensing (CAMS).
/// NOTE, however, that the code below will not run.
/// See the documentation on how to use CAMS: https://github.com/cph-cachet/carp.sensing-flutter/wiki
void main() async {
  SamplingPackageRegistry().register(HealthSamplingPackage());

  Study study = Study(id: "1234", userId: "bardram", name: "bardram study");

  // creating a task collecting step counts and blood pressure data for the last two days
  study.addTriggerTask(
    ImmediateTrigger(), // a simple trigger that starts immediately
    Task(name: 'Step and blood pressure')
      ..addMeasure(
        HealthMeasure(
          type: MeasureType(NameSpace.CARP, HealthSamplingPackage.HEALTH),
          healthDataType: HealthDataType.STEPS,
          name: 'Steps',
        ),
      )
      ..addMeasure(
        HealthMeasure(
            type: MeasureType(NameSpace.CARP, HealthSamplingPackage.HEALTH),
            healthDataType: HealthDataType.BLOOD_PRESSURE_DIASTOLIC,
            history: Duration(days: 2),
            name: 'Blood Pressure Diastolic'),
      )
      ..addMeasure(
        HealthMeasure(
            type: MeasureType(NameSpace.CARP, HealthSamplingPackage.HEALTH),
            healthDataType: HealthDataType.BLOOD_PRESSURE_SYSTOLIC,
            history: Duration(days: 2),
            name: 'Blood Pressure Systolic'),
      ),
  );

  // Create a Study Controller that can manage this study, initialize it, and start it.
  StudyController controller = StudyController(study);

  // await initialization before starting
  await controller.initialize();
  controller.resume();

  // listening on all data events from the study
  controller.events.forEach(print);
}
9
likes
0
pub points
71%
popularity

Publisher

verified publishercachet.dk

CARP health sampling package. Samples health data from Apple Health or Google Fit.

Homepage
Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

carp_mobile_sensing, flutter, health, json_annotation, meta, permission_handler, uuid

More

Packages that depend on carp_health_package