apskel-pos-flutter/lib/data/models/request/product_request_model.dart

43 lines
902 B
Dart
Raw Normal View History

2025-07-30 22:38:44 +07:00
import 'dart:developer';
import 'package:image_picker/image_picker.dart';
class ProductRequestModel {
final int? 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;
}
}