class Popular { String? backdropPath; int? id; String? originalLanguage; String? originalTitle; String? overview; double? popularity; String? posterPath; String? releaseDate; String? title; double? voteAverage; int? voteCount; bool hasFavorite = false; Popular({ this.backdropPath, this.id, this.originalLanguage, this.originalTitle, this.overview, this.popularity, this.posterPath, this.releaseDate, this.title, this.voteAverage, this.voteCount, }); Map toDb() { return { "id": id, "title": title, "posterPath": posterPath, "backdropPath": backdropPath, "overview": overview, }; } factory Popular.fromDb(Map map) { return Popular( id: map['id'], title: map['title'], posterPath: map['posterPath'], backdropPath: map['backdropPath'], overview: map['overview'], ); } factory Popular.fromMap(Map 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'], ); } }