const String Goog_tableName = 'goods'; const String Goog_columnId = 'id'; const String Goog_columnArticul = 'articul'; const String Goog_columnName = 'name'; const String Goog_columnPrice = 'price'; const String Goog_columnCategoryId = 'category_id'; const String Goog_columnEan = 'ean'; const String Goog_columnAppCompanyId = 'app_company_id'; const String Goog_columnDescription = 'description'; const String Goog_columnShowPrice = 'show_price'; const String Goog_columnOkei = 'okei'; const String Goog_columnDiscount = 'discount'; class Good { int id; int articul; String name; double price; int categoryId; String ean; int appCompanyId; String description; double showPrice; int okei; double discount; Map toMap() { var map = { Goog_columnArticul: articul, Goog_columnName: name, Goog_columnPrice: price, Goog_columnCategoryId: categoryId, Goog_columnEan: ean, Goog_columnAppCompanyId: appCompanyId, Goog_columnDescription: description, Goog_columnShowPrice: showPrice, Goog_columnOkei: okei, Goog_columnDiscount: discount }; if (id != null) { map[Goog_columnId] = id; } return map; } Good(); Good.fromMap(Map map) { id = map[Goog_columnId]; articul = map[Goog_columnArticul]; name = map[Goog_columnName]; price = map[Goog_columnPrice]?.toDouble(); categoryId = map[Goog_columnCategoryId]; ean = map[Goog_columnEan]; appCompanyId= map[Goog_columnAppCompanyId]; description = map[Goog_columnDescription]; showPrice = map[Goog_columnShowPrice]?.toDouble(); okei = map[Goog_columnOkei]; discount = map[Goog_columnDiscount]?.toDouble(); } Good.fromJson(Map map) { id = map[Goog_columnId]; articul = map[Goog_columnArticul]; name = map[Goog_columnName]; price = double.parse(map[Goog_columnPrice]); categoryId = map[Goog_columnCategoryId]; ean = map[Goog_columnEan]; appCompanyId = map[Goog_columnAppCompanyId]; description = map[Goog_columnDescription]; showPrice = map[Goog_columnShowPrice]?.toDouble(); okei = map[Goog_columnOkei]; discount = map[Goog_columnDiscount]?.toDouble(); } }