barcode_scanner/lib/backend/schema/product/product_struct.freezed.dart
mandreshope 44289e29dc feat: Adds product image field to data models
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.
2025-07-03 17:20:44 +03:00

167 lines
7.1 KiB
Dart

// dart format width=80
// coverage:ignore-file
// GENERATED CODE - DO NOT MODIFY BY HAND
// ignore_for_file: type=lint
// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark
part of 'product_struct.dart';
// **************************************************************************
// FreezedGenerator
// **************************************************************************
// dart format off
T _$identity<T>(T value) => value;
/// @nodoc
mixin _$ProductStruct {
int get id; String? get code; String? get name; String? get description; String? get price; String? get quantity; String? get image;
/// Create a copy of ProductStruct
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@pragma('vm:prefer-inline')
$ProductStructCopyWith<ProductStruct> get copyWith => _$ProductStructCopyWithImpl<ProductStruct>(this as ProductStruct, _$identity);
/// Serializes this ProductStruct to a JSON map.
Map<String, dynamic> toJson();
@override
bool operator ==(Object other) {
return identical(this, other) || (other.runtimeType == runtimeType&&other is ProductStruct&&(identical(other.id, id) || other.id == id)&&(identical(other.code, code) || other.code == code)&&(identical(other.name, name) || other.name == name)&&(identical(other.description, description) || other.description == description)&&(identical(other.price, price) || other.price == price)&&(identical(other.quantity, quantity) || other.quantity == quantity)&&(identical(other.image, image) || other.image == image));
}
@JsonKey(includeFromJson: false, includeToJson: false)
@override
int get hashCode => Object.hash(runtimeType,id,code,name,description,price,quantity,image);
@override
String toString() {
return 'ProductStruct(id: $id, code: $code, name: $name, description: $description, price: $price, quantity: $quantity, image: $image)';
}
}
/// @nodoc
abstract mixin class $ProductStructCopyWith<$Res> {
factory $ProductStructCopyWith(ProductStruct value, $Res Function(ProductStruct) _then) = _$ProductStructCopyWithImpl;
@useResult
$Res call({
int id, String? code, String? name, String? description, String? price, String? quantity, String? image
});
}
/// @nodoc
class _$ProductStructCopyWithImpl<$Res>
implements $ProductStructCopyWith<$Res> {
_$ProductStructCopyWithImpl(this._self, this._then);
final ProductStruct _self;
final $Res Function(ProductStruct) _then;
/// Create a copy of ProductStruct
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline') @override $Res call({Object? id = null,Object? code = freezed,Object? name = freezed,Object? description = freezed,Object? price = freezed,Object? quantity = freezed,Object? image = freezed,}) {
return _then(_self.copyWith(
id: null == id ? _self.id : id // ignore: cast_nullable_to_non_nullable
as int,code: freezed == code ? _self.code : code // ignore: cast_nullable_to_non_nullable
as String?,name: freezed == name ? _self.name : name // ignore: cast_nullable_to_non_nullable
as String?,description: freezed == description ? _self.description : description // ignore: cast_nullable_to_non_nullable
as String?,price: freezed == price ? _self.price : price // ignore: cast_nullable_to_non_nullable
as String?,quantity: freezed == quantity ? _self.quantity : quantity // ignore: cast_nullable_to_non_nullable
as String?,image: freezed == image ? _self.image : image // ignore: cast_nullable_to_non_nullable
as String?,
));
}
}
/// @nodoc
@JsonSerializable()
class _ProductStruct implements ProductStruct {
_ProductStruct({this.id = 0, this.code, this.name, this.description, this.price, this.quantity, this.image});
factory _ProductStruct.fromJson(Map<String, dynamic> json) => _$ProductStructFromJson(json);
@override@JsonKey() final int id;
@override final String? code;
@override final String? name;
@override final String? description;
@override final String? price;
@override final String? quantity;
@override final String? image;
/// Create a copy of ProductStruct
/// with the given fields replaced by the non-null parameter values.
@override @JsonKey(includeFromJson: false, includeToJson: false)
@pragma('vm:prefer-inline')
_$ProductStructCopyWith<_ProductStruct> get copyWith => __$ProductStructCopyWithImpl<_ProductStruct>(this, _$identity);
@override
Map<String, dynamic> toJson() {
return _$ProductStructToJson(this, );
}
@override
bool operator ==(Object other) {
return identical(this, other) || (other.runtimeType == runtimeType&&other is _ProductStruct&&(identical(other.id, id) || other.id == id)&&(identical(other.code, code) || other.code == code)&&(identical(other.name, name) || other.name == name)&&(identical(other.description, description) || other.description == description)&&(identical(other.price, price) || other.price == price)&&(identical(other.quantity, quantity) || other.quantity == quantity)&&(identical(other.image, image) || other.image == image));
}
@JsonKey(includeFromJson: false, includeToJson: false)
@override
int get hashCode => Object.hash(runtimeType,id,code,name,description,price,quantity,image);
@override
String toString() {
return 'ProductStruct(id: $id, code: $code, name: $name, description: $description, price: $price, quantity: $quantity, image: $image)';
}
}
/// @nodoc
abstract mixin class _$ProductStructCopyWith<$Res> implements $ProductStructCopyWith<$Res> {
factory _$ProductStructCopyWith(_ProductStruct value, $Res Function(_ProductStruct) _then) = __$ProductStructCopyWithImpl;
@override @useResult
$Res call({
int id, String? code, String? name, String? description, String? price, String? quantity, String? image
});
}
/// @nodoc
class __$ProductStructCopyWithImpl<$Res>
implements _$ProductStructCopyWith<$Res> {
__$ProductStructCopyWithImpl(this._self, this._then);
final _ProductStruct _self;
final $Res Function(_ProductStruct) _then;
/// Create a copy of ProductStruct
/// with the given fields replaced by the non-null parameter values.
@override @pragma('vm:prefer-inline') $Res call({Object? id = null,Object? code = freezed,Object? name = freezed,Object? description = freezed,Object? price = freezed,Object? quantity = freezed,Object? image = freezed,}) {
return _then(_ProductStruct(
id: null == id ? _self.id : id // ignore: cast_nullable_to_non_nullable
as int,code: freezed == code ? _self.code : code // ignore: cast_nullable_to_non_nullable
as String?,name: freezed == name ? _self.name : name // ignore: cast_nullable_to_non_nullable
as String?,description: freezed == description ? _self.description : description // ignore: cast_nullable_to_non_nullable
as String?,price: freezed == price ? _self.price : price // ignore: cast_nullable_to_non_nullable
as String?,quantity: freezed == quantity ? _self.quantity : quantity // ignore: cast_nullable_to_non_nullable
as String?,image: freezed == image ? _self.image : image // ignore: cast_nullable_to_non_nullable
as String?,
));
}
}
// dart format on