mirror of
https://github.com/SyncrowIOT/web.git
synced 2025-07-09 14:47:23 +00:00
Refactor RoutineDevices to use a class-level constant for allowed product types.
This commit is contained in:
@ -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,
|
||||
|
Reference in New Issue
Block a user