0

First I have to convert the integer to time (which I've managed to do so far) and then I want to schedule a notification on that time. You see that checkbox, When someone taps then alarm is set. So I don't multiple alarms. And most importantly I can't flutter default time picker (That works) but I can't use since I'm setting the alarm with my default time picker.

Now I want to take that value and convert that to time and set a notification on that time. Thanks everyone in advance Alarm App Screen

I've tried flutter_local_notifications package but I can't seem to figure out how can I take the integer value and set it to schedule notification.

Uwais7
  • 1
  • I think this article will helpful https://dev.to/devlonoah/convert-integer-value-to-hour-minute-seconds-in-dart-48hc – 1988 Feb 08 '23 at 09:59

1 Answers1

1

If I understand you correctly you mean you want to convert int to a DateTime and use it to schedule notifications.

to convert int to DateTime you can specify the current date and specify the hour and minute.

final now= DateTime.now();

DateTime(now.year,now.month,now.day,pm ? 12+ hour: hour, minute );

pm will be a bool that can be toogled by the user, so if the user picks 1pm the hr will be 13 since the hr has to be in 24hr format.

so after getting the dateTime use link to schedule notification with flutterLocalNotifications

odinachi
  • 180
  • 1
  • 5