deleteFrom method

Future<bool> deleteFrom(
  1. RoomType roomType,
  2. int entityKey, {
  3. int? playlistKey,
})

Used to delete a specific song(entity) from a specific room.

Parameters:

  • roomType this will define which room the entity will be deleted.
  • entityKey this is the key of the song that will be deleted.
  • playlistKey this will be the id/key of the playlist *.

* playlistKey it's only required when using RoomType.PLAYLIST.

Return:

  • If the song was deleted, will return true, if not, will return false.

See too:

Implementation

Future<bool> deleteFrom(
  RoomType roomType,
  int entityKey, {
  int? playlistKey,
}) async {
  if (roomType == RoomType.PLAYLIST && playlistKey == null) {
    throw Exception(
      "Cannot add [entity] to a undefined [playlist]\n"
      "Define the [playlistKey] parameter.",
    );
  }
  return await _controller.deleteFromController(
    roomType,
    entityKey,
    playlistKey: playlistKey,
  );
}