Line data Source code
1 : import 'package:flutter_chrome_cast/lib.dart';
2 :
3 : /// Represents a queue item for Google Cast on iOS platforms.
4 : ///
5 : /// This class extends [GoogleCastQueueItem] and provides additional
6 : /// iOS-specific mapping and construction logic.
7 : class GoogleCastQueueItemIOS extends GoogleCastQueueItem {
8 : /// Creates a [GoogleCastQueueItemIOS] instance.
9 : ///
10 : /// [mediaInformation] is required and contains the media details for the queue item.
11 : /// Other parameters are optional and provide additional playback and queue configuration.
12 1 : GoogleCastQueueItemIOS({
13 : required super.mediaInformation,
14 : super.activeTrackIds,
15 : super.autoPlay,
16 : super.customData,
17 : super.itemId,
18 : super.playbackDuration,
19 : super.preLoadTime,
20 : super.startTime,
21 : });
22 :
23 : /// Creates a [GoogleCastQueueItemIOS] from a [Map] representation.
24 : ///
25 : /// This factory parses the provided [map] and constructs an instance
26 : /// with the corresponding values, handling iOS-specific field names and types.
27 1 : factory GoogleCastQueueItemIOS.fromMap(Map<String, dynamic> map) {
28 1 : return GoogleCastQueueItemIOS(
29 1 : mediaInformation: GoogleCastMediaInformationIOS.fromMap(
30 2 : Map<String, dynamic>.from(map['mediaInformation'])),
31 2 : activeTrackIds: List.from(map['activeTracksIds'] ?? []),
32 1 : autoPlay: map['autoPlay'] ?? false,
33 1 : customData: map['customData'],
34 1 : itemId: map['itemId'],
35 1 : playbackDuration: map['playbackDuration'] == null
36 : ? null
37 0 : : Duration(seconds: map['playbackDuration']),
38 2 : preLoadTime: Duration(seconds: map['preLoadTime'] ?? 0),
39 2 : startTime: Duration(seconds: map['startTime'] ?? 0),
40 : );
41 : }
42 : }
|