toLastPlayedEntity method

LastPlayedEntity toLastPlayedEntity(
  1. int timePlayed, {
  2. int? lastTimePlayed,
})

Used to parse a Map into a LastPlayedEntity.

Important & Paramaters:

  • The key will be automatically generated and added.

  • If lastTimePlayed is null, will be set to DateTime.now().

  • Only this parameters will be used used:

    • @NonNull _data
    • _display_name
    • @NonNull _id
    • album
    • album_id
    • artist
    • artist_id
    • date_added
    • duration
    • @NonNull title
    • artwork

Implementation

LastPlayedEntity toLastPlayedEntity(int timePlayed, {int? lastTimePlayed}) {
  lastTimePlayed ??= DateTime.now().millisecondsSinceEpoch;
  return LastPlayedEntity(this["_id"] as int, timePlayed, lastTimePlayed)
    ..lastData = this["_data"]
    ..displayName = this["_display_name"]
    ..id = this["_id"]
    ..album = this["album"]
    ..albumId = this["album_id"]
    ..artist = this["artist"]
    ..artistId = this["artist_id"]
    ..dateAdded = this["date_added"]
    ..duration = this["duration"]
    ..title = this["title"]
    ..artworkAsBytes = this["artwork"];
}