Line data Source code
1 : import 'package:collection/collection.dart'; 2 : 3 : import 'package:widgetbook/src/models/device.dart'; 4 : 5 : class DeviceState { 6 : final List<Device> availableDevices; 7 : final Device currentDevice; 8 : 9 2 : DeviceState({ 10 : required this.availableDevices, 11 : required this.currentDevice, 12 : }); 13 : 14 2 : @override 15 : bool operator ==(Object other) { 16 : if (identical(this, other)) return true; 17 2 : final listEquals = const DeepCollectionEquality().equals; 18 : 19 2 : return other is DeviceState && 20 4 : listEquals(other.availableDevices, availableDevices) && 21 6 : other.currentDevice == currentDevice; 22 : } 23 : 24 1 : @override 25 5 : int get hashCode => availableDevices.hashCode ^ currentDevice.hashCode; 26 : }