decode method Null safety

MediaInfo decode(
  1. Object message
)

Implementation

static MediaInfo decode(Object message) {
  final Map<Object?, Object?> pigeonMap = message as Map<Object?, Object?>;
  return MediaInfo(
    contentId: pigeonMap['contentId'] as String?,
    streamType: pigeonMap['streamType'] != null
        ? StreamType.values[pigeonMap['streamType']! as int]
        : null,
    contentType: pigeonMap['contentType'] as String?,
    mediaMetadata: pigeonMap['mediaMetadata'] != null
        ? MediaMetadata.decode(pigeonMap['mediaMetadata']!)
        : null,
    mediaTracks: (pigeonMap['mediaTracks'] as List<Object?>?)?.cast<MediaTrack?>(),
    streamDuration: pigeonMap['streamDuration'] as int?,
    adBreakClips: (pigeonMap['adBreakClips'] as List<Object?>?)?.cast<AdBreakClipInfo?>(),
    customDataAsJson: pigeonMap['customDataAsJson'] as String?,
  );
}