32
loading...
This website collects cookies to deliver better user experience
public class Product
{
public int ProductId { get; set; }
public string Title { get; set; }
public string SubTitle { get; set; }
public bool IsActive { get; set; } = true;
}
public class ProductOption
{
public string Title { get; set; }
public double Price { get; set; }
public int QuantityInStock { get; set; }
}
// -- product.dart --
class Product {
int productId;
String title;
String subTitle;
bool isActive;
Product(this.productId,this.title,this.subTitle,this.isActive,);
}
// -- product_option.dart --
class ProductOption {
String title;
double price;
int quantityInStock;
ProductOption(this.title,this.price,this.quantityInStock,);
}
P.S. To learn more about JSON and serialization in Flutter, please see the Flutter documentation.