fixed tag model

This commit is contained in:
hannathkadher
2025-01-05 21:16:59 +04:00
parent 5bd257ee56
commit 0fda5457ae
9 changed files with 53 additions and 41 deletions

View File

@ -1,19 +1,25 @@
import 'package:syncrow_web/pages/spaces_management/all_spaces/model/product_model.dart';
import 'package:uuid/uuid.dart';
class TagModel {
String? uuid;
String tag;
final ProductModel? product;
String internalId;
TagModel({
this.uuid,
required this.tag,
this.product,
});
String? internalId,
}) : internalId = internalId ?? const Uuid().v4();
factory TagModel.fromJson(Map<String, dynamic> json) {
final String internalId = json['internalId'] ?? const Uuid().v4();
return TagModel(
uuid: json['uuid'] ?? '',
internalId: internalId,
tag: json['tag'] ?? '',
product: json['product'] != null
? ProductModel.fromMap(json['product'])
@ -29,4 +35,3 @@ class TagModel {
};
}
}