chore: fix Flutter baseline checks
This commit is contained in:
@@ -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()} км';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user