deleteData method

dynamic deleteData(
  1. EventNotificationModel _eventNotificationModel
)

deletes _eventNotificationModel if found

Implementation

deleteData(EventNotificationModel _eventNotificationModel) async {
  var key = _eventNotificationModel.key!;
  var keyKeyword = key.split('-')[0];
  var atkeyMicrosecondId = key.split('-')[1].split('@')[0];
  var response = await AtClientManager.getInstance().atClient.getKeys(
        regex: '$keyKeyword-$atkeyMicrosecondId',
      );
  if (response.isEmpty) {
    return;
  }

  var atkey = getAtKey(response[0]);
  await AtClientManager.getInstance().atClient.delete(atkey);
  removeData(key);
}