Skip to content

Commit

Permalink
check if insulin delivery reason is valid
Browse files Browse the repository at this point in the history
  • Loading branch information
António Valente committed Feb 21, 2023
1 parent 5b12a3a commit 7fbd3af
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions packages/health/lib/src/health_factory.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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<String, dynamic> args = {
'units': units,
'reason': reason.index,
Expand Down

0 comments on commit 7fbd3af

Please sign in to comment.