chore: fix Flutter baseline checks

This commit is contained in:
Artem Kokos
2026-04-22 21:08:02 +07:00
parent 8198ea09ae
commit ffc2ea1544
12 changed files with 68 additions and 54 deletions

View File

@@ -278,9 +278,10 @@ class GroupsNotifier extends Notifier<List<dynamic>> {
// Если группа залочена (недавно управляли) -- берём локальное состояние
if (_lockUntil.containsKey(id) && _lockUntil[id]!.isAfter(now)) {
final existing = state.cast<dynamic?>().firstWhere(
(old) => old?['id'].toString() == id,
orElse: () => null);
final existing = state.firstWhere(
(old) => old['id'].toString() == id,
orElse: () => null,
);
return existing ?? map;
}
@@ -311,9 +312,10 @@ class GroupsNotifier extends Notifier<List<dynamic>> {
}
} catch (e) {
// При ошибке опроса -- сохраняем предыдущее состояние
final existing = state.cast<dynamic?>().firstWhere(
(s) => s?['id'].toString() == id,
orElse: () => null);
final existing = state.firstWhere(
(s) => s['id'].toString() == id,
orElse: () => null,
);
map['last_state'] = existing?['last_state'] ??
{'state': false, 'brightness': 100, 'temp': 4000};
}
@@ -743,4 +745,4 @@ String formatDistance(double km) {
} else {
return '${km.round()} км';
}
}
}