notify method
- @override
- @Deprecated("Use NotificationService")
- AtKey atKey,
- String value,
- OperationEnum operation, {
- MessageTypeEnum? messageType,
- PriorityEnum? priority,
- StrategyEnum? strategy,
- int? latestN,
- String? notifier = AtConstants.system,
- 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’);
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;
}