LCOV - code coverage report
Current view: top level - data/models - movie_detail_model.dart (source / functions) Hit Total Coverage
Test: lcov.info Lines: 100 100 100.0 %
Date: 2026-03-02 18:37:46 Functions: 0 0 -

          Line data    Source code
       1             : class MovieDetail {
       2             :   final bool adult;
       3             :   final String? backdropPath;
       4             :   final dynamic belongsToCollection; // Can be null or a map
       5             :   final int budget;
       6             :   final List<Genre> genres;
       7             :   final String homepage;
       8             :   final int id;
       9             :   final String imdbId;
      10             :   final String originalLanguage;
      11             :   final String originalTitle;
      12             :   final String overview;
      13             :   final double popularity;
      14             :   final String? posterPath;
      15             :   final List<ProductionCompany> productionCompanies;
      16             :   final List<ProductionCountry> productionCountries;
      17             :   final String releaseDate;
      18             :   final int revenue;
      19             :   final int runtime;
      20             :   final List<SpokenLanguage> spokenLanguages;
      21             :   final String status;
      22             :   final String tagline;
      23             :   final String title;
      24             :   final bool video;
      25             :   final double voteAverage;
      26             :   final int voteCount;
      27             : 
      28           3 :   MovieDetail({
      29             :     required this.adult,
      30             :     this.backdropPath,
      31             :     this.belongsToCollection,
      32             :     required this.budget,
      33             :     required this.genres,
      34             :     required this.homepage,
      35             :     required this.id,
      36             :     required this.imdbId,
      37             :     required this.originalLanguage,
      38             :     required this.originalTitle,
      39             :     required this.overview,
      40             :     required this.popularity,
      41             :     this.posterPath,
      42             :     required this.productionCompanies,
      43             :     required this.productionCountries,
      44             :     required this.releaseDate,
      45             :     required this.revenue,
      46             :     required this.runtime,
      47             :     required this.spokenLanguages,
      48             :     required this.status,
      49             :     required this.tagline,
      50             :     required this.title,
      51             :     required this.video,
      52             :     required this.voteAverage,
      53             :     required this.voteCount,
      54             :   });
      55             : 
      56           2 :   factory MovieDetail.fromJson(Map<String, dynamic> json) {
      57           2 :     return MovieDetail(
      58           2 :       adult: json['adult'] as bool,
      59           2 :       backdropPath: json['backdrop_path'] as String?,
      60           2 :       belongsToCollection: json['belongs_to_collection'],
      61           2 :       budget: json['budget'] as int,
      62           2 :       genres: (json['genres'] as List<dynamic>)
      63           4 :           .map((e) => Genre.fromJson(e as Map<String, dynamic>))
      64           2 :           .toList(),
      65           2 :       homepage: json['homepage'] as String,
      66           2 :       id: json['id'] as int,
      67           4 :       imdbId: json['imdb_id'] != null ? json['imdb_id'] as String : '',
      68           2 :       originalLanguage: json['original_language'] as String,
      69           2 :       originalTitle: json['original_title'] as String,
      70           2 :       overview: json['overview'] as String,
      71           4 :       popularity: (json['popularity'] as num).toDouble(),
      72           2 :       posterPath: json['poster_path'] as String?,
      73           2 :       productionCompanies: (json['production_companies'] as List<dynamic>)
      74           4 :           .map((e) => ProductionCompany.fromJson(e as Map<String, dynamic>))
      75           2 :           .toList(),
      76           2 :       productionCountries: (json['production_countries'] as List<dynamic>)
      77           4 :           .map((e) => ProductionCountry.fromJson(e as Map<String, dynamic>))
      78           2 :           .toList(),
      79           2 :       releaseDate: json['release_date'] as String,
      80           2 :       revenue: json['revenue'] as int,
      81           2 :       runtime: json['runtime'] as int,
      82           2 :       spokenLanguages: (json['spoken_languages'] as List<dynamic>)
      83           4 :           .map((e) => SpokenLanguage.fromJson(e as Map<String, dynamic>))
      84           2 :           .toList(),
      85           2 :       status: json['status'] as String,
      86           2 :       tagline: json['tagline'] as String,
      87           2 :       title: json['title'] as String,
      88           2 :       video: json['video'] as bool,
      89           4 :       voteAverage: (json['vote_average'] as num).toDouble(),
      90           2 :       voteCount: json['vote_count'] as int,
      91             :     );
      92             :   }
      93             : 
      94           1 :   Map<String, dynamic> toJson() {
      95           1 :     return {
      96           1 :       'adult': adult,
      97           1 :       'backdrop_path': backdropPath,
      98           1 :       'belongs_to_collection': belongsToCollection,
      99           1 :       'budget': budget,
     100           5 :       'genres': genres.map((e) => e.toJson()).toList(),
     101           1 :       'homepage': homepage,
     102           1 :       'id': id,
     103           1 :       'imdb_id': imdbId,
     104           1 :       'original_language': originalLanguage,
     105           1 :       'original_title': originalTitle,
     106           1 :       'overview': overview,
     107           1 :       'popularity': popularity,
     108           1 :       'poster_path': posterPath,
     109           1 :       'production_companies': productionCompanies
     110           3 :           .map((e) => e.toJson())
     111           1 :           .toList(),
     112           1 :       'production_countries': productionCountries
     113           3 :           .map((e) => e.toJson())
     114           1 :           .toList(),
     115           1 :       'release_date': releaseDate,
     116           1 :       'revenue': revenue,
     117           1 :       'runtime': runtime,
     118           5 :       'spoken_languages': spokenLanguages.map((e) => e.toJson()).toList(),
     119           1 :       'status': status,
     120           1 :       'tagline': tagline,
     121           1 :       'title': title,
     122           1 :       'video': video,
     123           1 :       'vote_average': voteAverage,
     124           1 :       'vote_count': voteCount,
     125             :     };
     126             :   }
     127             : }
     128             : 
     129             : class Genre {
     130             :   final int id;
     131             :   final String name;
     132             : 
     133           2 :   Genre({required this.id, required this.name});
     134             : 
     135           1 :   factory Genre.fromJson(Map<String, dynamic> json) {
     136           3 :     return Genre(id: json['id'] as int, name: json['name'] as String);
     137             :   }
     138             : 
     139           1 :   Map<String, dynamic> toJson() {
     140           3 :     return {'id': id, 'name': name};
     141             :   }
     142             : }
     143             : 
     144             : class ProductionCompany {
     145             :   final int id;
     146             :   final String? logoPath;
     147             :   final String name;
     148             :   final String originCountry;
     149             : 
     150           1 :   ProductionCompany({
     151             :     required this.id,
     152             :     this.logoPath,
     153             :     required this.name,
     154             :     required this.originCountry,
     155             :   });
     156             : 
     157           1 :   factory ProductionCompany.fromJson(Map<String, dynamic> json) {
     158           1 :     return ProductionCompany(
     159           1 :       id: json['id'] as int,
     160           1 :       logoPath: json['logo_path'] as String?,
     161           1 :       name: json['name'] as String,
     162           1 :       originCountry: json['origin_country'] as String,
     163             :     );
     164             :   }
     165             : 
     166           1 :   Map<String, dynamic> toJson() {
     167           1 :     return {
     168           1 :       'id': id,
     169           1 :       'logo_path': logoPath,
     170           1 :       'name': name,
     171           1 :       'origin_country': originCountry,
     172             :     };
     173             :   }
     174             : }
     175             : 
     176             : class ProductionCountry {
     177             :   final String iso31661;
     178             :   final String name;
     179             : 
     180           1 :   ProductionCountry({required this.iso31661, required this.name});
     181             : 
     182           1 :   factory ProductionCountry.fromJson(Map<String, dynamic> json) {
     183           1 :     return ProductionCountry(
     184           1 :       iso31661: json['iso_3166_1'] as String,
     185           1 :       name: json['name'] as String,
     186             :     );
     187             :   }
     188             : 
     189           1 :   Map<String, dynamic> toJson() {
     190           3 :     return {'iso_3166_1': iso31661, 'name': name};
     191             :   }
     192             : }
     193             : 
     194             : class SpokenLanguage {
     195             :   final String englishName;
     196             :   final String iso6391;
     197             :   final String name;
     198             : 
     199           1 :   SpokenLanguage({
     200             :     required this.englishName,
     201             :     required this.iso6391,
     202             :     required this.name,
     203             :   });
     204             : 
     205           1 :   factory SpokenLanguage.fromJson(Map<String, dynamic> json) {
     206           1 :     return SpokenLanguage(
     207           1 :       englishName: json['english_name'] as String,
     208           1 :       iso6391: json['iso_639_1'] as String,
     209           1 :       name: json['name'] as String,
     210             :     );
     211             :   }
     212             : 
     213           1 :   Map<String, dynamic> toJson() {
     214           4 :     return {'english_name': englishName, 'iso_639_1': iso6391, 'name': name};
     215             :   }
     216             : }

Generated by: LCOV version 1.14