fromMap static method

Audio? fromMap(
  1. Map<String, dynamic>? _map
)
override

Construct from Map.

Implementation

static Audio? fromMap(Map<String, dynamic>? _map) {
  if (_map == null) return null;
  var _ = _map["@type"];
  if (_ != CONSTRUCTOR) return null;
  var extra = _map['@extra'];
  var clientId = _map['@clientId'];
  var duration = _map['duration']! as int;
  var title = _map['title']! as String;
  var performer = _map['performer']! as String;
  var file_name = _map['file_name']! as String;
  var mime_type = _map['mime_type']! as String;
  var album_cover_minithumbnail =
      Minithumbnail.fromMap(_map['album_cover_minithumbnail']);
  var album_cover_thumbnail =
      Thumbnail.fromMap(_map['album_cover_thumbnail']);
  var external_album_covers = List<Thumbnail>.from(
    (_map["external_album_covers"] ?? []).map(
      (e) => Thumbnail.fromMap(e),
    ),
  );
  var audio = File.fromMap(_map['audio'])!;
  return Audio(
    extra: extra,
    clientId: clientId,
    duration: duration,
    title: title,
    performer: performer,
    file_name: file_name,
    mime_type: mime_type,
    album_cover_minithumbnail: album_cover_minithumbnail,
    album_cover_thumbnail: album_cover_thumbnail,
    external_album_covers: external_album_covers,
    audio: audio,
  );
}