Skip to content

Instantly share code, notes, and snippets.

View gdelataillade's full-sized avatar
🎯
Focusing

Gautier de Lataillade gdelataillade

🎯
Focusing
View GitHub Profile
@gdelataillade
gdelataillade / periodic_alarms.dart
Created March 13, 2024 22:59
Example of implementation of periodic alarms with Flutter alarm plugin.
// Let's say we want to set a periodic alarm for each Monday, Wednesday and Friday at 9:41.
// Run this function on app launch when Alarm.init is done.
// It will make sure your periodic alarms are set for the following week.
Future<void> periodicAlarms() async {
const nbDays = 7; // Number of following days to potentially set alarm
const time = TimeOfDay(hour: 9, minute: 41); // Time of the periodic alarm
const days = [
DateTime.monday,
DateTime.wednesday,
DateTime.friday,