vitals 0.2.0 copy "vitals: ^0.2.0" to clipboard
vitals: ^0.2.0 copied to clipboard

Type-safe Apple Health and Health Connect. Bucketed statistics computed natively, and writing verified end to end on iOS.

0.2.0 #

Writing is verified on iOS. 250 ml of water written and read back at the same value and unit, end to end.

Previous versions said writing had never been observed to work and suggested the iOS Simulator might be at fault. That was wrong, and the fault was here: this package's own example had a Runner.entitlements file that was never referenced by its Xcode project — CODE_SIGN_ENTITLEMENTS was absent — so the app was built with no HealthKit entitlement and every write was refused. The package's write path was correct the whole time.

The iOS setup section now warns about it, because adding the file by hand without wiring it in is an easy mistake and produces exactly this symptom: builds fine, reads look fine, every write returns Not authorized.

The write documentation described an API that does not exist. 0.1.2 showed writeMass(type, 71.2, unit: Mass.kilograms) and writeCount(..., at:). Neither is real — the unit is carried by the value type, and counts take a period rather than an instant. Every snippet in that section is now compiled against the real API by test/readme_examples_test.dart, so a wrong signature fails the suite instead of reaching a reader.

  • Adds a screenshot of the verified write.
  • Adds example/integration_test/write_roundtrip_test.dart, which asserts the value that comes back as well as the count — a unit-conversion mistake would otherwise be silent.

Android is still unverified. The Health Connect round trip has not been run.

0.1.2 #

Documentation only — no API changes.

  • Writing is now documented at all. The package has seven write methods and the README showed none of them, so the only way to discover how to write a sample was to read the source. There is a section for it now, with the table mapping each VitalType<T> to the method that accepts it.
  • That mapping turns out to be the nicest thing about the write API and was entirely invisible: the types are generic, so writeMass(VitalType.steps, …) does not compile. The compiler picks the method for you. Worth saying out loud.
  • The README's examples used Vitals.instance in the first snippet and a bare vitals in later ones, with nothing introducing it. They all use Vitals.instance now.

0.1.1 #

Packaging only — no API or behaviour changes.

  • Added .pubignore. Previous versions shipped the package's own test/ directory and the example's integration tests to everyone who depended on it.

0.1.0 #

Initial release.

Reading is verified; writing is not. Reads are exercised against a real HealthKit store. Writes compile on both platforms but have not been observed to succeed end to end — the iOS Simulator rejects save as unauthorised even after the sheet is granted, and the Android round trip is unrun. Verify written values land correctly before relying on them.

Typed throughout #

  • VitalType<T> carries the Dart type it reads back as, so read(VitalType.steps) returns List<CountSample> and read(VitalType.bodyMass) returns List<MassSample>. No casting, no codegen.
  • Mass, Length, Energy, Volume, Temperature, Pressure and Concentration store one canonical value with named accessors.
  • 21 vital types, each declaring the aggregation that suits it.

Permissions, modelled on what the platforms can actually answer #

  • No readAccess(). HKAuthorizationStatus has three values and all three describe sharing; iOS cannot report read access by design.
  • readAccessOnAndroid() returns null on iOS rather than guessing.
  • AuthorizationNotDeterminedException covers the one state iOS does report: a query made before the user was ever asked.

Statistics #

  • Hourly, daily, weekly and monthly buckets, reduced on the platform side.
  • A bucket with no samples reports null, not zero.

Testing #

  • FakeVitals runs the whole API in memory, including an ineligible device, a refused sheet, and the iOS silent read denial.
1
likes
0
points
360
downloads

Documentation

Documentation

Publisher

verified publisherjumyn.com

Weekly Downloads

Type-safe Apple Health and Health Connect. Bucketed statistics computed natively, and writing verified end to end on iOS.

Repository (GitHub)
View/report issues

Topics

#health #healthkit #health-connect #fitness #ios

License

unknown (license)

Dependencies

flutter

More

Packages that depend on vitals

Packages that implement vitals