Extend Task Model to Include Serialization

This commit adds serialization support to the Task model by including a `toJson` method. This will allow easy conversion of Task objects to a JSON-compatible format, facilitating storage or network transmission.
This commit is contained in:
hunteraraujo
2023-09-18 14:35:34 -07:00
parent e90eb0fd61
commit e446d723ee

View File

@@ -45,13 +45,19 @@ class Task {
); );
} }
Map<String, dynamic> toJson() {
return {
'task_id': id,
'input': title,
'additional_input': additionalInput,
'artifacts': artifacts,
};
}
@override @override
bool operator ==(Object other) => bool operator ==(Object other) =>
identical(this, other) || identical(this, other) ||
other is Task && other is Task && runtimeType == other.runtimeType && id == other.id;
runtimeType == other.runtimeType &&
id == other.id &&
title == other.title;
@override @override
int get hashCode => id.hashCode ^ title.hashCode; int get hashCode => id.hashCode ^ title.hashCode;