delete method

Future<bool> delete()

Deletes _data from the repository. If the suppression is sucessful, returns true. Otherwise, false.

Implementation

Future<bool> delete() async {
  if (_data == null) {
    AppEventsDispatcher().publish(OperationFailedEvent(OperationType.delete, service.repositoryId, _data!));
    return false;
  }

  await service.delete(_data!);

  notifyListeners();
  AppEventsDispatcher().publish(DataDeletedEvent(service.repositoryId, _data!));

  _data = null;

  return true;
}