You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

36 lines
907 B

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