decode method Null safety

MediaStatus decode(
  1. Object message
)

Implementation

static MediaStatus decode(Object message) {
  final Map<Object?, Object?> pigeonMap = message as Map<Object?, Object?>;
  return MediaStatus(
    playerState: pigeonMap['playerState'] != null
        ? PlayerState.values[pigeonMap['playerState']! as int]
        : null,
    isPlayingAd: pigeonMap['isPlayingAd'] as bool?,
    mediaInfo: pigeonMap['mediaInfo'] != null
        ? MediaInfo.decode(pigeonMap['mediaInfo']!)
        : null,
    adBreakStatus: pigeonMap['adBreakStatus'] != null
        ? AdBreakStatus.decode(pigeonMap['adBreakStatus']!)
        : null,
  );
}