Updates from idk when...
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user