// Author: fengshengxiong // Date: 2024/8/6 // Description: 广告配置模型 import 'dart:convert'; class AdConfigModel { List? coldLoading; List? hotLoading; List? play; List? download; List? list; List? library; List? playCut; List? search; List? searchResult; List? backup; AdConfigModel({ this.coldLoading, this.hotLoading, this.play, this.download, this.list, this.library, this.playCut, this.search, this.searchResult, this.backup, }); factory AdConfigModel.fromJson(String str) => AdConfigModel.fromMap(json.decode(str)); String toJson() => json.encode(toMap()); factory AdConfigModel.fromMap(Map json) => AdConfigModel( coldLoading: json["coldLoading"] == null ? [] : List.from(json["coldLoading"]!.map((x) => AdModel.fromMap(x))), hotLoading: json["hotLoading"] == null ? [] : List.from(json["hotLoading"]!.map((x) => AdModel.fromMap(x))), play: json["play"] == null ? [] : List.from(json["play"]!.map((x) => AdModel.fromMap(x))), download: json["download"] == null ? [] : List.from(json["download"]!.map((x) => AdModel.fromMap(x))), list: json["list"] == null ? [] : List.from(json["list"]!.map((x) => AdModel.fromMap(x))), library: json["library"] == null ? [] : List.from(json["library"]!.map((x) => AdModel.fromMap(x))), playCut: json["playCut"] == null ? [] : List.from(json["playCut"]!.map((x) => AdModel.fromMap(x))), search: json["search"] == null ? [] : List.from(json["search"]!.map((x) => AdModel.fromMap(x))), searchResult: json["searchResult"] == null ? [] : List.from(json["searchResult"]!.map((x) => AdModel.fromMap(x))), backup: json["backup"] == null ? [] : List.from(json["backup"]!.map((x) => AdModel.fromMap(x))), ); Map toMap() => { "coldLoading": coldLoading == null ? [] : List.from(coldLoading!.map((x) => x.toMap())), "hotLoading": hotLoading == null ? [] : List.from(hotLoading!.map((x) => x.toMap())), "play": play == null ? [] : List.from(play!.map((x) => x.toMap())), "download": download == null ? [] : List.from(download!.map((x) => x.toMap())), "list": list == null ? [] : List.from(list!.map((x) => x.toMap())), "library": library == null ? [] : List.from(library!.map((x) => x.toMap())), "playCut": playCut == null ? [] : List.from(playCut!.map((x) => x.toMap())), "search": search == null ? [] : List.from(search!.map((x) => x.toMap())), "searchResult": searchResult == null ? [] : List.from(searchResult!.map((x) => x.toMap())), "backup": backup == null ? [] : List.from(backup!.map((x) => x.toMap())), }; } class AdModel { int? level; String? identifier; String? ad; String? type; AdModel({ this.level, this.identifier, this.ad, this.type, }); factory AdModel.fromJson(String str) => AdModel.fromMap(json.decode(str)); String toJson() => json.encode(toMap()); factory AdModel.fromMap(Map json) => AdModel( level: json["level"], identifier: json["identifier"], ad: json["ad"], type: json["type"], ); Map toMap() => { "level": level, "identifier": identifier, "ad": ad, "type": type, }; }