getSavedAlarms static method
Returns all alarms info from local storage in the case app is terminated and we need to restore previously scheduled alarms.
Implementation
static List<AlarmSettings> getSavedAlarms() {
final alarms = <AlarmSettings>[];
final keys = prefs.getKeys();
for (final key in keys) {
if (key.startsWith(prefix)) {
final res = prefs.getString(key);
alarms.add(
AlarmSettings.fromJson(json.decode(res!) as Map<String, dynamic>),
);
}
}
return alarms;
}