Line data Source code
1 : import 'package:flutter_chrome_cast/entities/cast_device.dart';
2 :
3 : /// Represents a Google Cast device specific to iOS platforms.
4 : ///
5 : /// This class extends [GoogleCastDevice] to include iOS-specific properties
6 : /// and construction from a map structure typically returned by iOS platform channels.
7 : class GoogleCastIosDevice extends GoogleCastDevice {
8 : /// Optional index of the device in the iOS discovery list.
9 : final int? index;
10 :
11 : /// Creates a new [GoogleCastIosDevice] instance.
12 : ///
13 : /// All parameters except [index] are required and are passed to the base [GoogleCastDevice].
14 1 : GoogleCastIosDevice({
15 : required super.deviceID,
16 : required super.friendlyName,
17 : required super.modelName,
18 : required super.statusText,
19 : required super.deviceVersion,
20 : required super.isOnLocalNetwork,
21 : required super.category,
22 : required super.uniqueID,
23 : required this.index,
24 : });
25 :
26 : /// Creates a [GoogleCastIosDevice] from a map, typically from platform channel data.
27 1 : factory GoogleCastIosDevice.fromMap(Map<String, dynamic> map) {
28 1 : return GoogleCastIosDevice(
29 1 : deviceID: map['deviceID'] as String,
30 1 : friendlyName: map['friendlyName'] ?? '',
31 1 : modelName: map['modelName'],
32 1 : statusText: map['statusText'],
33 1 : deviceVersion: map['deviceVersion'] ?? '',
34 1 : isOnLocalNetwork: map['isOnLocalNetwork'] as bool,
35 1 : category: map['category'] as String,
36 1 : uniqueID: map['uniqueID'] as String,
37 1 : index: map['index'],
38 : );
39 : }
40 : }
|