From 88e0248480aad8959b39a3eec92946bc093483bb Mon Sep 17 00:00:00 2001 From: Roland Geider Date: Fri, 24 Apr 2026 12:38:50 +0200 Subject: [PATCH] Remove BodyWeightState This wasn't used at the moment, and if we need any filter Methods, we can add it back --- lib/providers/body_weight_state.dart | 38 ---------------------------- 1 file changed, 38 deletions(-) delete mode 100644 lib/providers/body_weight_state.dart diff --git a/lib/providers/body_weight_state.dart b/lib/providers/body_weight_state.dart deleted file mode 100644 index 79c897e07..000000000 --- a/lib/providers/body_weight_state.dart +++ /dev/null @@ -1,38 +0,0 @@ -import 'package:logging/logging.dart'; -import 'package:state_notifier/state_notifier.dart'; -import 'package:wger/models/body_weight/weight_entry.dart'; - -/* - * TODO: decide if we want to use the state or just handle a list of entries - */ -class BodyWeightState extends StateNotifier> { - final _logger = Logger('BodyWeightState'); - - BodyWeightState([super.initial = const []]); - - List get items => [...state]; - - WeightEntry? getNewestEntry() => state.isNotEmpty ? state.first : null; - - WeightEntry? findById(String id) { - try { - return state.firstWhere((e) => e.id == id); - } on StateError { - return null; - } - } - - WeightEntry? findByDate(DateTime date) { - try { - return state.firstWhere((e) => e.date == date); - } on StateError { - return null; - } - } - - void clear() => state = []; - - void setItems(List entries) { - state = List.from(entries); - } -}