createPlaylist method

Future<int?> createPlaylist(
  1. String playlistName,
  2. {bool ignoreDuplicate = false}
)

Used to create a internal playlist.

Usage:

  • To create a internal playlist you will only need one information.

    • Playlist Name

You can use toPlaylistEntity method extension from a String.

Parameters:

  • playlistName this is the name of the playlist.
  • ignoreDuplicate this will ignore(or no) any playlist with the same name.

Important:

  • When creating a playlist, the unique parameter you need to set is playlistName.
  • If the return is equal to 0, this playlist already exist.
  • The key will be automatically setted.
  • The playlistDateModified will be automatically setted.
  • The playlistDataAdded will be automatically setted.
  • The playlistSongs will be empty.

Example:

PlaylistEntity playlistEntity = "My playlist".toPlaylistEntity();

Return:

  • Will return a int representing the playlist Id.

See too:

Implementation

Future<int?> createPlaylist(
  String playlistName, {
  bool ignoreDuplicate = false,
}) async {
  return await _PlaylistDao().createPlaylist(
    OnPlaylistFormatter(playlistName).toPlaylistEntity,
    ignoreDuplicate,
  );
}