Updates from idk when...

This commit is contained in:
Nathan Anderson
2023-08-17 13:34:30 -06:00
parent 6fae83674b
commit 1d1b5f0620
18 changed files with 614 additions and 161 deletions
+22
View File
@@ -189,4 +189,26 @@ class DashBoardStateNotifier extends StateNotifier<Map<String, dynamic>?> {
break;
}
}
void removeWithId(String stateKey, int id) {
if (state == null) {
printPink('Cant remove data, state is null');
return;
}
switch (stateKey) {
case 'transactions':
case 'budget_categories':
case 'shared_noted':
final subStateList = state![stateKey] as List<dynamic>;
final newState = state;
subStateList
.removeWhere((e) => (e as Map<String, dynamic>)['id'] == id);
newState![stateKey] = subStateList;
state = {...newState};
// printBlue(state);
break;
default:
break;
}
}
}