newAtKey method

AtKey newAtKey(
  1. int ttr,
  2. String key,
  3. String? sharedWith, {
  4. int? ttl,
  5. DateTime? expiresAt,
})

returns a new AtKey.

Implementation

AtKey newAtKey(int ttr, String key, String? sharedWith,
    {int? ttl, DateTime? expiresAt}) {
  var atKey = AtKey()
    ..metadata = Metadata()
    ..metadata.ttr = ttr
    ..metadata.ccd = true
    ..key = key
    ..sharedWith = sharedWith
    ..sharedBy = AtLocationNotificationListener().currentAtSign;
  if (ttl != null) atKey.metadata.ttl = ttl;
  if (expiresAt != null) atKey.metadata.expiresAt = expiresAt;
  return atKey;
}