schedule static method
Future<bool>
schedule(
- UNotificationRequest request,
- DateTime at, {
- URepeat repeat = URepeat.none,
- URepeatCalendar calendar = URepeatCalendar.gregorian,
- bool exact = true,
Shows request at at, optionally repeating. Survives restarts (and reboots on Android).
Implementation
static Future<bool> schedule(
UNotificationRequest request,
DateTime at, {
URepeat repeat = URepeat.none,
URepeatCalendar calendar = URepeatCalendar.gregorian,
bool exact = true,
}) async {
await init();
final UNotificationRequest ready = await _prepare(request);
final Map<String, Object?> record = <String, Object?>{
"request": ready.toMap(),
"at": at.millisecondsSinceEpoch,
"repeat": repeat.name,
"calendar": calendar.name,
};
if (_softScheduler) {
await _store(ready.id, record);
_arm(ready.id, record);
return true;
}
if (_needsBatch(record)) {
await _store(ready.id, record);
return _scheduleBatch(ready.id, record);
}
return await _call<bool>("schedule", <String, Object?>{...record, "exact": exact}) ?? false;
}