From 7fbd3af8148074f24069a5171b5f1e0dfbdac65f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Anto=CC=81nio=20Valente?= Date: Tue, 21 Feb 2023 18:55:38 +0000 Subject: [PATCH] check if insulin delivery reason is valid --- packages/health/lib/src/health_factory.dart | 3 +++ 1 file changed, 3 insertions(+) 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,