diff --git a/packages/health/lib/src/health_factory.dart b/packages/health/lib/src/health_factory.dart index 161e10037..3b4f4aacc 100644 --- a/packages/health/lib/src/health_factory.dart +++ b/packages/health/lib/src/health_factory.dart @@ -356,6 +356,9 @@ class HealthFactory { if (startTime.isAfter(endTime)) throw ArgumentError("startTime must be equal or earlier than endTime"); + if (reason == InsulinDeliveryReason.NOT_SET) + throw ArgumentError("set a valid insulin delivery reason"); + Map args = { 'units': units, 'reason': reason.index,