showNotification static method

Future<void> showNotification({
  1. required int playerId,
  2. required String title,
  3. required String artist,
  4. required String clipArt,
})

Implementation

static Future<void> showNotification({required int playerId, required String title, required String artist, required String clipArt}) async {
  const channel = BasicMessageChannel<dynamic>('io.github.wangyng.simple_audio_player.showNotification', StandardMessageCodec());

  final Map<String, dynamic> requestMap = {};
  requestMap["playerId"] = playerId;
  requestMap["title"] = title;
  requestMap["artist"] = artist;
  requestMap["clipArt"] = clipArt;
  final reply = await channel.send(requestMap);

  if (!(reply is Map)) {
    _throwChannelException();
  }

  final replyMap = Map<String, dynamic>.from(reply);
  if (replyMap['error'] != null) {
    final error = Map<String, dynamic>.from(replyMap['error']);
    _throwException(error);

  } else {
    // noop
  }
}