removeSchedule method
Remove the schedule.
Specify the ID of the schedule to be deleted in uid
.
スケジュールを削除します。
uid
に削除するスケジュールのIDを指定します。
Implementation
Future<void> removeSchedule(String uid) async {
if (_completer != null) {
await _completer!.future;
}
await adapter.listen();
_completer = Completer<void>();
try {
final modelQuery = LocalNotificationScheduleModel.collection().modelQuery;
final col = LocalNotificationScheduleModelCollection(modelQuery);
await col.load();
final id = await adapter.removeSchedule(uid);
if (id != null) {
final found = col.firstWhereOrNull((e) => e.value?.id == id);
await found?.delete();
}
_sendLog(NotificationLoggerEvent.removeSchedule, parameters: {
NotificationLoggerEvent.uidKey: uid,
});
notifyListeners();
_completer?.complete();
_completer = null;
} catch (e, stacktrace) {
_completer?.completeError(e, stacktrace);
_completer = null;
} finally {
_completer?.complete();
_completer = null;
}
}