Remove unused copyWith method from Status class and simplify status assignment in ScheduleBloc

This commit is contained in:
mohammad
2025-06-30 15:22:02 +03:00
parent fd239a3907
commit 5486f0832d
2 changed files with 0 additions and 19 deletions

View File

@ -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)); factory Status.fromJson(String source) => Status.fromMap(json.decode(source));
String toJson() => json.encode(toMap()); String toJson() => json.encode(toMap());

View File

@ -298,15 +298,6 @@ class ScheduleBloc extends Bloc<ScheduleEvent, ScheduleState> {
} }
final dateTime = DateTime.parse(event.time); 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( final updatedSchedule = ScheduleEntry(
scheduleId: event.scheduleId, scheduleId: event.scheduleId,
category: event.category, category: event.category,