notify method

  1. @override
  2. @Deprecated("Use NotificationService")
Future<bool> notify(
  1. AtKey atKey,
  2. String value,
  3. OperationEnum operation, {
  4. MessageTypeEnum? messageType,
  5. PriorityEnum? priority,
  6. StrategyEnum? strategy,
  7. int? latestN,
  8. String? notifier = AtConstants.system,
  9. bool isDedicated = false,
})
override

Notifies the AtKey with the sharedWith user of the atsign. Optionally, operation, value and metadata can be set along with key to notify.

e.g alice is the current atsign
notify:update:@bob:phone@alice:+1 999 9999
  var key = AtKey()..key='phone'
            ..sharedWith='@bob'
  var value='+1 999 9999'
  var operation=OperationEnum.update
  notify(key, value, operation);
notify:update:ttl:60000:ttb:30000:@bob:phone@alice:+1 999 9999
  var metaData = Metadata()..ttl='60000'
                 ..ttb='30000'
  var key = AtKey()..key='phone'
            ..sharedWith='@bob'
            ..metadata=metaData
  var value='+1 999 9999'
  var operation=OperationEnum.update
  notify(key, value, operation);

var atKey = AtKey()..key = 'phone@alice'
                   ..sharedWith = '@bob'
                   ..sharedBy = ‘@alice’
Sending Notification with Notification Strategy ‘ALL’ and priority low
await atClient.notify(atKey, ‘+1 987 986 2233’, OperationEnum.update,
                      priority: PriorityEnum.low,
                     strategy: StrategyEnum.all);

Sending Notification with Notification Strategy ‘Latest N’ and priority high
await atClient.notify(atKey, ‘+1 987 986 2233’, OperationEnum.update,
                      priority: PriorityEnum.high,
                      strategy: StrategyEnum.latest,
                      latestN:3,
                      Notifier: ‘wavi’);

Deprecated Use AtClient.notificationService

Implementation

@override
@Deprecated("Use NotificationService")
Future<bool> notify(AtKey atKey, String value, OperationEnum operation,
    {MessageTypeEnum? messageType,
    PriorityEnum? priority,
    StrategyEnum? strategy,
    int? latestN,
    String? notifier = AtConstants.system,
    bool isDedicated = false}) async {
  AtKeyValidators.get().validate(
      atKey.toString(),
      ValidationContext()
        ..atSign = _atSign
        ..validateOwnership = true);
  final notificationParams =
      NotificationParams.forUpdate(atKey, value: value);
  final notifyResult = await notificationService.notify(notificationParams);
  return notifyResult.notificationStatusEnum ==
      NotificationStatusEnum.delivered;
}