amangautam1/flutter-musicplayer

Please share the changes you had made in flute_music_player plugin

Closed this issue ยท 9 comments

like the function toMap()

I had made few changes to the original library to match the app needs. The updated class Song is as below.


class Song {
  int id;
  String artist;
  String title;
  String album;
  int albumId;
  int duration;
  String uri;
  String albumArt;
  int isFav=0;
  int timestamp=0;
  int count=0;

  Song(this.id, this.artist, this.title, this.album, this.albumId,
      this.duration, this.uri, this.albumArt,{this.isFav=0,this.timestamp=0,this.count=0});

  Song.fromMap(Map m) {
    id = m["id"];
    artist = m["artist"];
    title = m["title"];
    album = m["album"];
    albumId = m["albumId"];
    duration = m["duration"];
    uri = m["uri"];
    albumArt = m["albumArt"];
    isFav=m["isFav"];
    timestamp=m["timestamp"];
    count=m["count"];
  }
  static final Columns=["id","artist", "title", "album", "albumId", "duration", "uri", "albumArt","isFav","timestamp"];

  Map toMap(){
    Map<String,dynamic> map={
      "id":id,
      "artist":artist,
      "title":title,
      "album":album,
      "albumId":albumId,
      "duration":duration,
      "uri":uri,
      "albumArt":albumArt,
      "isFav":isFav,
      "timestamp":timestamp,
      "count":count,
    };
    return map;
  }
}

Error like that,
How to fixed it

error

Thanks you,

Thanks

where i have to paste this code?

@Nimto007 where i have to use this cod, i mean in which section?

where i have to paste this code?

You need to paste the code at the place where you installed your flutter sdk
Go to
flutter ->.pub-cache -> hosted-> pub.dartlang.org -> flute_music_player-0.0.6 -> lib -> flute_music_player.dart
then at the end of that file you can see " Class song " and replace the whole class with the given class.
Hope this is helpful.๐Ÿ™‚