
Includes an `image` field in the `ProductStruct` and `ProductEntity` data models. Updates the ObjectBox schema and regenerates the necessary code to persist the new field. Refactors the `ProductScannedComponent` to accept a `ProductStruct` object, simplifying parameter passing. Updates the `ScannerPage` to build and pass the `ProductStruct` to the component, enabling the display of the product image and using the structured data for other details like quantity. The 'Marque' display is replaced with 'Quantité' in the component.
21 lines
501 B
Dart
21 lines
501 B
Dart
import 'package:freezed_annotation/freezed_annotation.dart';
|
|
|
|
part 'product_struct.freezed.dart';
|
|
part 'product_struct.g.dart';
|
|
|
|
@Freezed(toJson: true)
|
|
abstract class ProductStruct with _$ProductStruct {
|
|
factory ProductStruct({
|
|
@Default(0) int id,
|
|
String? code,
|
|
String? name,
|
|
String? description,
|
|
String? price,
|
|
String? quantity,
|
|
String? image,
|
|
}) = _ProductStruct;
|
|
|
|
factory ProductStruct.fromJson(Map<String, dynamic> json) =>
|
|
_$ProductStructFromJson(json);
|
|
}
|