class VideoZoneItem { const VideoZoneItem({ required this.id, required this.name, required this.coverUrl, required this.videoUrl, required this.accessible, }); factory VideoZoneItem.fromJson(Map json) { int toInt(dynamic value) => value is num ? value.toInt() : int.tryParse('$value') ?? 0; bool toBool(dynamic value) => value == true || value == 1 || value?.toString() == 'true'; return VideoZoneItem( id: toInt(json['id']), name: json['name']?.toString() ?? '', coverUrl: json['coverUrl']?.toString() ?? '', videoUrl: json['videoUrl']?.toString() ?? '', accessible: toBool(json['accessible']), ); } final int id; final String name; final String coverUrl; final String videoUrl; final bool accessible; String get title => name; }