deleteVar function
Implementation
bool deleteVar(WidgetRef ref, String v) {
Role? r = ref.read(rolesProvider.notifier).state.remove(v);
Type? t = ref.read(typesProvider.notifier).state.remove(v);
String selected = ref.read(selectedProvider);
String selected2 = ref.read(selected2Provider);
if (selected == v) {
ref.read(selectedProvider.notifier).state = 'NULL';
}
if (selected2 == v) {
ref.read(selected2Provider.notifier).state = 'NULL';
}
if (r == null) {
debugPrint('ERROR: Attempt to delete $v from ROLES but not in the map.');
return false;
} else if (t == null) {
debugPrint('ERROR: Attempt to delete $v from TYPES but not in the map.');
return false;
}
return true;
}