45 lines
975 B
Dart
45 lines
975 B
Dart
|
part of fever_api;
|
||
|
|
||
|
class Item {
|
||
|
final FeverAPI api;
|
||
|
|
||
|
late int id;
|
||
|
late int feedId;
|
||
|
late String title;
|
||
|
late String author;
|
||
|
late String html;
|
||
|
late String url;
|
||
|
late bool isSaved;
|
||
|
late bool isRead;
|
||
|
late DateTime createdOnTime;
|
||
|
|
||
|
Item(this.api, {
|
||
|
required this.id,
|
||
|
required this.feedId,
|
||
|
required this.title,
|
||
|
required this.author,
|
||
|
required this.html,
|
||
|
required this.url,
|
||
|
required this.isSaved,
|
||
|
required this.isRead,
|
||
|
required this.createdOnTime,
|
||
|
});
|
||
|
|
||
|
Item.fromJSON(this.api, Map<String, dynamic> json) {
|
||
|
id = toInt(json['id']);
|
||
|
feedId = toInt(json['feed_id']);
|
||
|
title = json['title'];
|
||
|
author = json['author'];
|
||
|
html = json['html'];
|
||
|
url = json['url'];
|
||
|
isSaved = json['is_saved'] == '1';
|
||
|
isRead = json['is_read'] == '1';
|
||
|
createdOnTime = DateTime.fromMillisecondsSinceEpoch(toInt(json['created_on_time']) * 1000);
|
||
|
}
|
||
|
|
||
|
@override
|
||
|
String toString() {
|
||
|
return 'Item $id: $title';
|
||
|
}
|
||
|
}
|