forUpdate static method

NotificationParams forUpdate(
  1. AtKey atKey, {
  2. String? value,
  3. PriorityEnum priority = PriorityEnum.low,
  4. StrategyEnum strategy = StrategyEnum.all,
  5. int latestN = 1,
  6. String notifier = AtConstants.system,
  7. Duration? notificationExpiry,
})

Returns NotificationParams to send an update notification.

Optionally accepts the following

  • priority: Represents the priority of the notification. The notification marked PriorityEnum.high takes precedence over other notifications.

  • strategy: When notifications marked with StrategyEnum.all, all the notifications are sent. For StrategyEnum.latest, only the latestN of a notifier are sent

  • latestN: Represents the count of notifications to store that belong to a particular notifier.

  • notifier: Groups the notifications that has the same notifier.

  • notificationExpiry: Refers to the amount of time the notification is available in the KeyStore. Beyond which the notification is removed from the KeyStore.

Implementation

static NotificationParams forUpdate(AtKey atKey,
    {String? value,
    PriorityEnum priority = PriorityEnum.low,
    StrategyEnum strategy = StrategyEnum.all,
    int latestN = 1,
    String notifier = AtConstants.system,
    Duration? notificationExpiry}) {
  return NotificationParams()
    .._id = Uuid().v4()
    .._atKey = atKey
    .._value = value
    .._operation = OperationEnum.update
    .._messageType = MessageTypeEnum.key
    .._priority = priority
    .._strategy = strategy
    .._latestN = latestN
    .._notifier = notifier
    .._notificationExpiry = notificationExpiry ?? Duration(hours: 24);
}