import 'package:teso/Classes/API%20Clasess/Product.dart'; class ExploreClass { List? trending; List? latest; ExploreClass({ this.trending, this.latest, }); factory ExploreClass.fromJSON(Map json) { var trends = json["trending"] as List; List trendProducts = trends.map((e) => Product.fromJson(e)).toList(); var newProducts = json["latest"] as List; List newewst = newProducts.map((e) => Product.fromJson(e)).toList(); return ExploreClass( trending: trendProducts, latest: newewst, ); } Map toJson() { final Map data = Map(); data['trending'] = this.trending; data['latest'] = this.latest; return data; } @override String toString() { return '{"trending": "$trending", "latest": "$latest"}'; } }