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

          Line data    Source code
       1             : class MovieModel {
       2             :   final bool adult;
       3             :   final String backdropPath;
       4             :   final List<int> genreIds;
       5             :   final int id;
       6             :   final String originalLanguage;
       7             :   final String originalTitle;
       8             :   final String overview;
       9             :   final double popularity;
      10             :   final String posterPath;
      11             :   final String releaseDate;
      12             :   final String title;
      13             :   final bool video;
      14             :   final double voteAverage;
      15             :   final int voteCount;
      16             :   final List<String> genres;
      17             : 
      18           3 :   const MovieModel({
      19             :     required this.adult,
      20             :     required this.backdropPath,
      21             :     required this.genreIds,
      22             :     required this.id,
      23             :     required this.originalLanguage,
      24             :     required this.originalTitle,
      25             :     required this.overview,
      26             :     required this.popularity,
      27             :     required this.posterPath,
      28             :     required this.releaseDate,
      29             :     required this.title,
      30             :     required this.video,
      31             :     required this.voteAverage,
      32             :     required this.voteCount,
      33             :     this.genres = const [],
      34             :   });
      35             : 
      36           1 :   factory MovieModel.fromJson(Map<String, dynamic> json) {
      37           1 :     return MovieModel(
      38           1 :       adult: json['adult'] ?? false,
      39           1 :       backdropPath: json['backdrop_path'] ?? '',
      40           2 :       genreIds: List<int>.from(json['genre_ids'] ?? []),
      41           1 :       id: json['id'] ?? 0,
      42           1 :       originalLanguage: json['original_language'] ?? '',
      43           1 :       originalTitle: json['original_title'] ?? '',
      44           1 :       overview: json['overview'] ?? '',
      45           2 :       popularity: (json['popularity'] is int)
      46           0 :           ? (json['popularity'] as int).toDouble()
      47           2 :           : (json['popularity'] ?? 0.0).toDouble(),
      48           1 :       posterPath: json['poster_path'] ?? '',
      49           1 :       releaseDate: json['release_date'] ?? '',
      50           1 :       title: json['title'] ?? '',
      51           1 :       video: json['video'] ?? false,
      52           2 :       voteAverage: (json['vote_average'] is int)
      53           0 :           ? (json['vote_average'] as int).toDouble()
      54           2 :           : (json['vote_average'] ?? 0.0).toDouble(),
      55           1 :       voteCount: json['vote_count'] ?? 0,
      56             :     );
      57             :   }
      58             : 
      59           1 :   Map<String, dynamic> toJson() {
      60           1 :     return {
      61           1 :       'adult': adult,
      62           1 :       'backdrop_path': backdropPath,
      63           1 :       'genre_ids': genreIds,
      64           1 :       'id': id,
      65           1 :       'original_language': originalLanguage,
      66           1 :       'original_title': originalTitle,
      67           1 :       'overview': overview,
      68           1 :       'popularity': popularity,
      69           1 :       'poster_path': posterPath,
      70           1 :       'release_date': releaseDate,
      71           1 :       'title': title,
      72           1 :       'video': video,
      73           1 :       'vote_average': voteAverage,
      74           1 :       'vote_count': voteCount,
      75             :     };
      76             :   }
      77             : }

Generated by: LCOV version 1.14