[0.1.2]
This commit is contained in:
@@ -97,7 +97,12 @@ class AstromicFormController extends FormController {
|
||||
/// Get the value of a hosted state variable using it's ID.
|
||||
T? getValue<T>(String id) {
|
||||
prepareValue(id, false);
|
||||
return _hostedValues[id]?.$1?.$1;
|
||||
|
||||
if (_hostedValues[id]?.$1 is T?) {
|
||||
return _hostedValues[id]?.$1;
|
||||
} else {
|
||||
throw FlutterError('Value found but is not of the type $T, it\'s of type ${_hostedValues[id]?.$1.runtimeType}');
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
|
||||
@@ -110,7 +110,7 @@ class _FormValueWrapperState<T> extends State<FormValueWrapper<T>> {
|
||||
builder: (BuildContext context, AsyncSnapshot<(String, bool)> validationSnapshot) {
|
||||
return widget.builder(widget.controller.getValue<T>(widget.id),
|
||||
validationSnapshot.hasData && validationSnapshot.data != null && validationSnapshot.data!.$1 == widget.id && validationSnapshot.data!.$2 ? true : false, (T newValue, bool isRequired) {
|
||||
return widget.controller.setValue(widget.id, (newValue, isRequired));
|
||||
return widget.controller.setValue(widget.id, newValue,isRequired: isRequired);
|
||||
});
|
||||
});
|
||||
//!SECTION
|
||||
|
||||
Reference in New Issue
Block a user