simplified code across the app and consolidated duplicated helpers
This commit is contained in:
@@ -34,8 +34,7 @@ class TimetableFavoritesSettings {
|
||||
/// Adds or removes the element in place. Returns the new favorite state
|
||||
/// (`true` = now starred). Callers persist via `SettingsCubit.val(write: true)`.
|
||||
bool toggle(TimetableElementType type, int id, String label) {
|
||||
final existing = favorites.where((f) => f.type == type && f.id == id);
|
||||
if (existing.isNotEmpty) {
|
||||
if (isFavorite(type, id)) {
|
||||
favorites.removeWhere((f) => f.type == type && f.id == id);
|
||||
return false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user