nowPlaying method

Future<GeneralInfo> nowPlaying ()

Retrieve information about the current playing song on the queue.

Implementation

Future<GeneralInfo> nowPlaying() async {
  if(Platform.isIOS){
    try {
      var result = await playerChannel.invokeMethod('nowPlaying');
      var resobj = new Map<String, dynamic>.from(result);
      Artist artist = Artist(albums: [], name: resobj["artist"]);
      Album album = Album(songs: [], title: resobj["albumTitle"], albumTrackCount: resobj["albumTrackCount"], coverArt: Image.memory(resobj["image"]), diskCount: resobj["diskCount"], artistName: artist.name);
      Song song = Song(albumTitle: album.title, title: resobj["songTitle"], trackNumber: resobj["albumTrackNumber"], discNumber: resobj["discNumber"], isExplicit: resobj["isExplicitItem"], playCount: resobj["playCount"], artistName: artist.name, iOSSongID: resobj["songID"]);
      album.songs.add(song);
      artist.albums.add(album);
      album.artistName = artist.name;
      GeneralInfo info = GeneralInfo(album: album, artist: artist, song: song);
      return info;
    } catch(e){
      print(e);
      return null;
    }
  }
}