summaryrefslogtreecommitdiff
path: root/lib/models/popular.dart
diff options
context:
space:
mode:
authorIván Ávalos <avalos@disroot.org>2023-03-26 21:04:58 -0600
committerIván Ávalos <avalos@disroot.org>2023-03-26 21:04:58 -0600
commit4b7d33896879baba1435281f814766a80fbeecb2 (patch)
tree9cc37361f5a8ccffa5a4c4da20120b54b1649d69 /lib/models/popular.dart
parent68d54a5660e1c6651a604b078e78a2658ca61ea1 (diff)
downloadpmsna1-4b7d33896879baba1435281f814766a80fbeecb2.tar.gz
pmsna1-4b7d33896879baba1435281f814766a80fbeecb2.tar.bz2
pmsna1-4b7d33896879baba1435281f814766a80fbeecb2.zip
Added popular movies screen and Firebase support
Diffstat (limited to 'lib/models/popular.dart')
-rw-r--r--lib/models/popular.dart45
1 files changed, 45 insertions, 0 deletions
diff --git a/lib/models/popular.dart b/lib/models/popular.dart
new file mode 100644
index 0000000..afe6858
--- /dev/null
+++ b/lib/models/popular.dart
@@ -0,0 +1,45 @@
+class Popular {
+ String? backdropPath;
+ int? id;
+ String? originalLanguage;
+ String? originalTitle;
+ String? overview;
+ double? popularity;
+ String? posterPath;
+ String? releaseDate;
+ String? title;
+ double? voteAverage;
+ int? voteCount;
+
+ Popular({
+ this.backdropPath,
+ this.id,
+ this.originalLanguage,
+ this.originalTitle,
+ this.overview,
+ this.popularity,
+ this.posterPath,
+ this.releaseDate,
+ this.title,
+ this.voteAverage,
+ this.voteCount,
+ });
+
+ factory Popular.fromMap(Map<String, dynamic> map) {
+ return Popular(
+ backdropPath: map['backdrop_path'],
+ id: map['id'],
+ originalLanguage: map['original_language'],
+ originalTitle: map['original_title'],
+ overview: map['overview'],
+ popularity: map['popularity'],
+ posterPath: map['poster_path'],
+ releaseDate: map['release_date'],
+ title: map['title'],
+ voteAverage: (map['vote_average'] is int)
+ ? (map['vote_average'] as int).toDouble()
+ : map['vote_average'],
+ voteCount: map['vote_count'],
+ );
+ }
+}