From 5486f0832de017243bb4e677642f4b6d3a89f1b4 Mon Sep 17 00:00:00 2001 From: mohammad Date: Mon, 30 Jun 2025 15:22:02 +0300 Subject: [PATCH] Remove unused copyWith method from Status class and simplify status assignment in ScheduleBloc --- .../all_devices/models/device_status.dart | 10 ---------- .../schedule_device/bloc/schedule_bloc.dart | 9 --------- 2 files changed, 19 deletions(-) diff --git a/lib/pages/device_managment/all_devices/models/device_status.dart b/lib/pages/device_managment/all_devices/models/device_status.dart index b0af600e..1f23e3f9 100644 --- a/lib/pages/device_managment/all_devices/models/device_status.dart +++ b/lib/pages/device_managment/all_devices/models/device_status.dart @@ -57,16 +57,6 @@ class Status { }; } - Status copyWith({ - String? code, - dynamic value, - }) { - return Status( - code: code ?? this.code, - value: value ?? this.value, - ); - } - factory Status.fromJson(String source) => Status.fromMap(json.decode(source)); String toJson() => json.encode(toMap()); diff --git a/lib/pages/device_managment/schedule_device/bloc/schedule_bloc.dart b/lib/pages/device_managment/schedule_device/bloc/schedule_bloc.dart index 61896a74..65773590 100644 --- a/lib/pages/device_managment/schedule_device/bloc/schedule_bloc.dart +++ b/lib/pages/device_managment/schedule_device/bloc/schedule_bloc.dart @@ -298,15 +298,6 @@ class ScheduleBloc extends Bloc { } final dateTime = DateTime.parse(event.time); - Status status = Status(code: '', value: ''); - if (event.category == 'CUR_2') { - status = status.copyWith( - code: 'control', - value: event.functionOn == true ? 'open' : 'close'); - } else { - status = - status.copyWith(code: event.category, value: event.functionOn); - } final updatedSchedule = ScheduleEntry( scheduleId: event.scheduleId, category: event.category,