fromMap static method
Construct from the Map returned by MethodChannel.
The Map structure returned by the native side is symmetric to toMap():
the appId/fileId/pSign/quality/token fields are extracted into the
inner dataSource.
Implementation
static TXVodDownloadMediaInfo fromMap(Map map) {
final info = TXVodDownloadMediaInfo();
// When fileId-related fields are present, restore dataSource.
if (map['appId'] != null || map['fileId'] != null) {
final ds = TXVodDownloadDataSource();
ds.appId = map['appId'] as int?;
ds.fileId = map['fileId'] as String?;
ds.pSign = map['pSign'] as String?;
ds.quality = map['quality'] as int?;
ds.token = map['token'] as String?;
ds.userName = map['userName'] as String?;
info.dataSource = ds;
}
info.url = map['url'] as String?;
info.downloadState = map['downloadState'] as int?;
final progress = map['progress'];
info.progress = progress is num ? progress.toDouble() : null;
info.playPath = map['playPath'] as String?;
info.userName = map['userName'] as String?;
info.duration = map['duration'] as int?;
info.playableDuration = map['playableDuration'] as int?;
info.size = map['size'] as int?;
info.downloadSize = map['downloadSize'] as int?;
info.speed = map['speed'] as int?;
info.isResourceBroken = map['isResourceBroken'] as bool?;
return info;
}