From 30bf847e6ee1290824bff4956de6ff21db204ac4 Mon Sep 17 00:00:00 2001 From: Sikander Saleem Date: Mon, 8 Dec 2025 09:46:23 +0300 Subject: [PATCH] department dropdown return first index item fixed. --- .../loan_module/models/medical_department_model.dart | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/modules/loan_module/models/medical_department_model.dart b/lib/modules/loan_module/models/medical_department_model.dart index 08a6b200..1b0bbcb9 100644 --- a/lib/modules/loan_module/models/medical_department_model.dart +++ b/lib/modules/loan_module/models/medical_department_model.dart @@ -1,18 +1,20 @@ import 'package:test_sa/models/base.dart'; class MedicalDepartmentModel extends Base { - MedicalDepartmentModel({ - this.departmentName, this.departmentCode, this.ntCode, this.costCenterNumber, this.costCenterName, this.name, this.id, this.createdBy, this.createdDate, this.modifiedBy, this.modifiedDate - }) : super(identifier: id?.toString() ?? '', name: departmentName); // Handle potential null id + MedicalDepartmentModel( + {this.departmentName, this.departmentCode, this.ntCode, this.costCenterNumber, this.costCenterName, this.name, this.id, this.createdBy, this.createdDate, this.modifiedBy, this.modifiedDate}) + : super(identifier: id?.toString() ?? '', name: departmentName); // Handle potential null id MedicalDepartmentModel.fromJson(Map json) { + id = json['id']; + identifier = id?.toString() ?? ''; + name = json['departmentName'] ?? json['name']; departmentName = json['departmentName'] ?? json['name']; departmentCode = json['departmentCode']; ntCode = json['ntCode']; costCenterNumber = json['costCenterNumber']; costCenterName = json['costCenterName']; name = json['name']; - id = json['id']; createdBy = json['createdBy']; createdDate = json['createdDate']; modifiedBy = json['modifiedBy']; @@ -30,6 +32,4 @@ class MedicalDepartmentModel extends Base { String? createdDate; String? modifiedBy; String? modifiedDate; - - }