[0.1.2]
This commit is contained in:
@@ -82,7 +82,7 @@ class AstromicFormController extends FormController {
|
||||
|
||||
/// Prepare a hosted value.
|
||||
void prepareValue<T>(String id, bool isRequired) {
|
||||
return _hostedValues.addEntries(<MapEntry<String, (dynamic, bool)>>[MapEntry<String, (dynamic, bool)>(id, (null, isRequired))]);
|
||||
return _hostedValues.addEntries(<MapEntry<String, (T?, bool)>>[MapEntry<String, (T?, bool)>(id, (null, isRequired))]);
|
||||
}
|
||||
|
||||
/// Set the value of a hosted state variable using it's ID.
|
||||
|
||||
@@ -61,7 +61,7 @@ class _FormValueWrapperState<T> extends State<FormValueWrapper<T>> {
|
||||
//s1 --State
|
||||
//
|
||||
//s1 --Controllers & Listeners
|
||||
widget.controller.prepareValue(widget.id, widget.isRequired);
|
||||
widget.controller.prepareValue<T>(widget.id, widget.isRequired);
|
||||
//s1 --Controllers & Listeners
|
||||
//
|
||||
//s1 --Late & Async Initializers
|
||||
@@ -108,7 +108,7 @@ class _FormValueWrapperState<T> extends State<FormValueWrapper<T>> {
|
||||
return StreamBuilder<(String, bool)>(
|
||||
stream: widget.controller.hostedValueValidationStream,
|
||||
builder: (BuildContext context, AsyncSnapshot<(String, bool)> validationSnapshot) {
|
||||
return widget.builder(widget.controller.getValue(widget.id),
|
||||
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));
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user