summaryrefslogtreecommitdiff
path: root/lib/models/popular.dart
diff options
context:
space:
mode:
Diffstat (limited to 'lib/models/popular.dart')
-rw-r--r--lib/models/popular.dart22
1 files changed, 22 insertions, 0 deletions
diff --git a/lib/models/popular.dart b/lib/models/popular.dart
index afe6858..a1c136b 100644
--- a/lib/models/popular.dart
+++ b/lib/models/popular.dart
@@ -11,6 +11,8 @@ class Popular {
double? voteAverage;
int? voteCount;
+ bool hasFavorite = false;
+
Popular({
this.backdropPath,
this.id,
@@ -25,6 +27,26 @@ class Popular {
this.voteCount,
});
+ Map<String, dynamic> toDb() {
+ return {
+ "id": id,
+ "title": title,
+ "posterPath": posterPath,
+ "backdropPath": backdropPath,
+ "overview": overview,
+ };
+ }
+
+ factory Popular.fromDb(Map<String, dynamic> map) {
+ return Popular(
+ id: map['id'],
+ title: map['title'],
+ posterPath: map['posterPath'],
+ backdropPath: map['backdropPath'],
+ overview: map['overview'],
+ );
+ }
+
factory Popular.fromMap(Map<String, dynamic> map) {
return Popular(
backdropPath: map['backdrop_path'],