delete method

Future<bool> delete(
  1. T toDelete
)

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

Implementation

Future<bool> delete(T toDelete) async {
  if (toDelete.invalid ||
      !_data.any((element) => element.id == toDelete.id)) {
    return false;
  }

  _data.remove(toDelete);
  await service.delete(toDelete);

  notifyListeners();

  return true;
}