Refactor RoutineDevices to use a class-level constant for allowed product types.

This commit is contained in:
Faris Armoush
2025-04-09 09:57:18 +03:00
parent 7accf1d4c8
commit 9b69ec31e9

View File

@ -17,6 +17,8 @@ class _RoutineDevicesState extends State<RoutineDevices> {
context.read<RoutineBloc>().add(FetchDevicesInRoutine());
}
static const _allowedProductTypes = {'AC', '1G', '2G', '3G', 'WPS', 'GW'};
@override
Widget build(BuildContext context) {
return BlocBuilder<RoutineBloc, RoutineState>(
@ -31,10 +33,9 @@ class _RoutineDevicesState extends State<RoutineDevices> {
}
});
final deviceList = state.devices.where((device) {
const allowedProductTypes = {'AC', '1G', '2G', '3G', 'WPS', 'GW'};
return allowedProductTypes.contains(device.productType);
}).toList();
final deviceList = state.devices
.where((device) => _allowedProductTypes.contains(device.productType))
.toList();
return Wrap(
spacing: 10,