LCOV - code coverage report
Current view: top level - common - break.dart Coverage Total Hit
Test: lcov_cleaned.info Lines: 0.0 % 21 0
Test Date: 2025-06-20 10:50:47 Functions: - 0 0

            Line data    Source code
       1              : import 'dart:convert';
       2              : 
       3              : ///Represents a break (e.g. ad break)
       4              : ///included in the main video.
       5              : class CastBreak {
       6              :   ///List of break clip IDs included in this break.
       7              : 
       8              :   final List<String> breakClipIds;
       9              : 
      10              :   ///Duration of break in seconds.
      11              :   final Duration? duration;
      12              : 
      13              :   ///Unique ID of a break.
      14              :   final String id;
      15              : 
      16              :   /// Indicates whether the break is embedded in the main stream.
      17              : 
      18              :   final bool isEmbedded;
      19              : 
      20              :   /// Whether a break was watched. This is marked as
      21              :   ///  true when the break begins to play.
      22              :   /// A sender can change color of a progress
      23              :   ///  bar marker corresponding to this break
      24              :   /// once this field changes from false to
      25              :   /// true denoting that the end-user
      26              :   /// already watched this break.
      27              : 
      28              :   final bool isWatched;
      29              : 
      30              :   ///Location of the break inside the main video. -1 represents the end of the main video in seconds.
      31              : 
      32              :   final int position;
      33              : 
      34              :   /// Creates a new [CastBreak] instance.
      35            0 :   CastBreak({
      36              :     required this.breakClipIds,
      37              :     this.duration,
      38              :     required this.id,
      39              :     required this.isEmbedded,
      40              :     required this.isWatched,
      41              :     required this.position,
      42              :   });
      43              : 
      44              :   /// Converts this break to a map representation.
      45            0 :   Map<String, dynamic> toMap() {
      46            0 :     return {
      47            0 :       'breakClipIds': breakClipIds,
      48            0 :       'duration': duration?.inSeconds,
      49            0 :       'id': id,
      50            0 :       'isEmbedded': isEmbedded,
      51            0 :       'isWatched': isWatched,
      52            0 :       'position': position,
      53              :     };
      54              :   }
      55              : 
      56              :   /// Creates a [CastBreak] from a map representation.
      57            0 :   factory CastBreak.fromMap(Map<String, dynamic> map) {
      58            0 :     return CastBreak(
      59            0 :       breakClipIds: List<String>.from(map['breakClipIds']),
      60            0 :       duration: map['duration'] != null
      61            0 :           ? Duration(seconds: map['duration'].round())
      62              :           : null,
      63            0 :       id: map['id'] ?? '',
      64            0 :       isEmbedded: map['isEmbedded'] ?? false,
      65            0 :       isWatched: map['isWatched'] ?? false,
      66            0 :       position: map['position']?.toInt() ?? 0,
      67              :     );
      68              :   }
      69              : 
      70              :   /// Converts this break to a JSON string.
      71            0 :   String toJson() => json.encode(toMap());
      72              : 
      73              :   /// Creates a [CastBreak] from a JSON string.
      74            0 :   factory CastBreak.fromJson(String source) =>
      75            0 :       CastBreak.fromMap(json.decode(source));
      76              : }
        

Generated by: LCOV version 2.3.1-1