This commit is contained in:
2025-04-15 14:36:24 +02:00
parent d098b4a0d0
commit 50e7eead52

View File

@@ -108,7 +108,9 @@ class AstromicFormController extends FormController {
/// Get the value of a hosted state variable using it's ID.
T? getValue<T>(String id) {
prepareValue(id, false);
if (!_hostedValues.containsKey(id)) {
return null;
}
if (_hostedValues[id]?.$1 is T?) {
return _hostedValues[id]?.$1;
@@ -120,7 +122,8 @@ class AstromicFormController extends FormController {
/// Set the value of a hosted state variable using it's ID.
void setValue<T>(String id, T data, {bool isRequired = false}) {
prepareValue(id, isRequired);
_hostedValues[id] = (data, isRequired);
//
_hostedValues[id] = (data, _hostedValues[id]!.$2);
_hostedValueValidationStreamController.add((id, false));
}
@@ -134,11 +137,6 @@ class AstromicFormController extends FormController {
/// Validate hosted values.
bool validateValues(List<String> valueIDs) {
for (String hostedValueID in valueIDs) {
print('Trying to validate $hostedValueID in $_hostedValues');
print(_hostedValues.containsKey(hostedValueID));
print(_hostedValues[hostedValueID]!.$2);
print(_hostedValues[hostedValueID]!.$1);
print(_hostedValues[hostedValueID]!.$1 == null);
if (_hostedValues.containsKey(hostedValueID) && _hostedValues[hostedValueID]!.$2 && _hostedValues[hostedValueID]!.$1 == null) {
// Validation Error!
_hostedValueValidationStreamController.add((hostedValueID, true));