pending static method
Scheduled notifications that have not fired yet.
Implementation
static Future<List<UNotificationInfo>> pending() async {
if (_softScheduler || _windows) {
if (!UStorage.isReady) await UStorage.init();
return <UNotificationInfo>[
for (final MapEntry<String, Object?> e in _records().entries)
() {
final Map<String, Object?> record = Map<String, Object?>.from(e.value! as Map<dynamic, dynamic>);
final Map<String, Object?> request = Map<String, Object?>.from(record["request"]! as Map<dynamic, dynamic>);
final List<DateTime> next = upcoming(DateTime.fromMillisecondsSinceEpoch((record["at"]! as num).toInt()), _repeatOf(record), _calendarOf(record), 1);
return UNotificationInfo(id: int.parse(e.key), title: request["title"] as String?, body: request["body"] as String?, next: next.isEmpty ? null : next.first);
}(),
];
}
final List<Object?>? raw = await _call<List<Object?>>("pending");
return (raw ?? <Object?>[]).whereType<Map<Object?, Object?>>().map(UNotificationInfo.fromMap).toList();
}