Product.fromJson constructor
Creates a Product instance from JSON.
Implementation
factory Product.fromJson(Map<String, dynamic> json) {
return Product(
id: json['id'] ?? 0,
title: json['title'] ?? '',
price: (json['price'] ?? 0).toDouble(),
);
}