33 lines
657 B
Dart
33 lines
657 B
Dart
|
class Task {
|
||
|
final int id;
|
||
|
final String name;
|
||
|
final String description;
|
||
|
final String date;
|
||
|
final String imageUrl;
|
||
|
|
||
|
Task({
|
||
|
required this.id,
|
||
|
required this.name,
|
||
|
required this.description,
|
||
|
required this.date,
|
||
|
required this.imageUrl
|
||
|
});
|
||
|
|
||
|
Map<String, dynamic> toJson() {
|
||
|
return {
|
||
|
'name': name,
|
||
|
'description': description,
|
||
|
'date': date,
|
||
|
'imageUrl': imageUrl
|
||
|
};
|
||
|
}
|
||
|
factory Task.fromJson(Map<String, dynamic> json) {
|
||
|
return Task(
|
||
|
id: json['id'],
|
||
|
name: json['name'],
|
||
|
description: json['description'],
|
||
|
date: json['date'],
|
||
|
imageUrl: json['imageUrl']
|
||
|
);
|
||
|
}
|
||
|
}
|