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

            Line data    Source code
       1              : import 'dart:convert';
       2              : 
       3              : import 'package:flutter_chrome_cast/common/rfc5646_language.dart';
       4              : import 'package:flutter_chrome_cast/enums/text_track_type.dart';
       5              : import 'package:flutter_chrome_cast/enums/track_type.dart';
       6              : import 'package:flutter_chrome_cast/models/android/extensions/track_type.dart';
       7              : 
       8              : /// Represents a media track, including content type, ID, type, and serialization helpers.
       9              : class GoogleCastMediaTrack {
      10              :   /// Custom data for the track.
      11              :   final Map<String, dynamic>? customData;
      12              : 
      13              :   /// Language of the track.
      14              :   final Rfc5646Language? language;
      15              : 
      16              :   /// Name of the track.
      17              :   final String? name;
      18              : 
      19              :   /// Subtype of the track.
      20              :   final TextTrackType? subtype;
      21              : 
      22              :   /// Content ID of the track.
      23              :   final String? trackContentId;
      24              : 
      25              :   /// Content type of the track.
      26              :   final String trackContentType;
      27              : 
      28              :   /// Unique identifier of the track within the context of a MediaInfo object.
      29              :   final int trackId;
      30              : 
      31              :   /// The type of track.
      32              :   final TrackType type;
      33              : 
      34              :   /// Creates a new [GoogleCastMediaTrack] instance.
      35            0 :   GoogleCastMediaTrack({
      36              :     this.customData,
      37              :     this.language,
      38              :     this.name,
      39              :     this.subtype,
      40              :     this.trackContentId,
      41              :     required this.trackContentType,
      42              :     required this.trackId,
      43              :     required this.type,
      44              :   });
      45              : 
      46              :   /// Converts the object to a map for serialization.
      47            0 :   Map<String, dynamic> toMap() {
      48            0 :     return {
      49            0 :       'customData': customData,
      50            0 :       'language': language?.toString(),
      51            0 :       'name': name,
      52            0 :       'subtype': subtype?.index,
      53            0 :       'trackContentId': trackContentId,
      54            0 :       'trackContentType': trackContentType,
      55            0 :       'trackId': trackId,
      56            0 :       'type': type.index,
      57              :     };
      58              :   }
      59              : 
      60              :   /// Creates a [GoogleCastMediaTrack] from a map.
      61            0 :   factory GoogleCastMediaTrack.fromMap(Map<String, dynamic> map) {
      62            0 :     return GoogleCastMediaTrack(
      63            0 :       customData: Map<String, dynamic>.from(map['customData'] ?? {}),
      64            0 :       language: map['language'] != null
      65            0 :           ? Rfc5646Language.fromMap(map['language'])
      66              :           : null,
      67            0 :       name: map['name'],
      68            0 :       subtype: map['subtype'] != null
      69            0 :           ? TextTrackType.values.firstWhere(
      70            0 :               (e) => e.name == map['subtype'],
      71            0 :               orElse: () => TextTrackType.unknown,
      72              :             )
      73              :           : null,
      74            0 :       trackContentId: map['trackContentId'],
      75            0 :       trackContentType: map['trackContentType'],
      76            0 :       trackId: map['trackId']?.toInt() ?? 0,
      77            0 :       type: GoogleCastTrackTypeAndroid.fromMap(map['type']),
      78              :     );
      79              :   }
      80              : 
      81              :   /// Converts the object to a JSON string.
      82            0 :   String toJson() => json.encode(toMap());
      83              : 
      84              :   /// Creates a [GoogleCastMediaTrack] from a JSON string.
      85            0 :   factory GoogleCastMediaTrack.fromJson(String source) =>
      86            0 :       GoogleCastMediaTrack.fromMap(json.decode(source));
      87              : }
        

Generated by: LCOV version 2.3.1-1