apskel-pos-flutter/lib/data/models/request/product_request_model.dart
2025-08-03 00:35:00 +07:00

43 lines
897 B
Dart

import 'dart:developer';
import 'package:image_picker/image_picker.dart';
class ProductRequestModel {
final String? id;
final String name;
final int price;
final int stock;
final int categoryId;
final int isBestSeller;
final XFile? image;
final String? printerType;
ProductRequestModel({
this.id,
required this.name,
required this.price,
required this.stock,
required this.categoryId,
required this.isBestSeller,
this.image,
this.printerType,
});
Map<String, String> toMap() {
log("toMap: $isBestSeller");
final map = {
'name': name,
'price': price.toString(),
'stock': stock.toString(),
'category_id': categoryId.toString(),
'is_best_seller': isBestSeller.toString(),
'printer_type': printerType ?? '',
};
if (id != null) {
map['id'] = id.toString();
}
return map;
}
}