From 9b69ec31e9200df34cc3ce4aadad23219507894a Mon Sep 17 00:00:00 2001 From: Faris Armoush Date: Wed, 9 Apr 2025 09:57:18 +0300 Subject: [PATCH] Refactor RoutineDevices to use a class-level constant for allowed product types. --- lib/pages/routines/widgets/routine_devices.dart | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/lib/pages/routines/widgets/routine_devices.dart b/lib/pages/routines/widgets/routine_devices.dart index ba5756e0..f6ff0db9 100644 --- a/lib/pages/routines/widgets/routine_devices.dart +++ b/lib/pages/routines/widgets/routine_devices.dart @@ -17,6 +17,8 @@ class _RoutineDevicesState extends State { context.read().add(FetchDevicesInRoutine()); } + static const _allowedProductTypes = {'AC', '1G', '2G', '3G', 'WPS', 'GW'}; + @override Widget build(BuildContext context) { return BlocBuilder( @@ -31,10 +33,9 @@ class _RoutineDevicesState extends State { } }); - 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,