delete method

Future<bool> delete(
  1. String atsign
)

Deletes the atsign from followers and following lists.

Implementation

Future<bool> delete(String atsign) async {
  bool result;

  //deleting @sign from followers
  var atKey = this._formKey();
  var atMetadata = atKey.metadata;
  result = await _modifyKey(atsign, followers, atKey);
  //notify @sign about delete
  if (result) {
    atKey..sharedWith = atsign;
    atMetadata..isPublic = false;
    atKey..metadata = atMetadata;
    await _sdkService.notify(
        atKey, atsign, OperationEnum.delete, _onNotifyDone, _onNotifyError);
  }

  //deleting @sign from following
  atKey = this._formKey(isFollowing: true);
  atMetadata = atKey.metadata;
  result = await _modifyKey(atsign, following, atKey);
  //notify @sign about delete
  if (result) {
    atKey..sharedWith = atsign;
    atMetadata..isPublic = false;
    atKey..metadata = atMetadata;
    await _sdkService.notify(
        atKey, atsign, OperationEnum.delete, _onNotifyDone, _onNotifyError);
  }

  await _sdkService.sync();
  return result;
}