This commit is contained in:
2025-03-23 16:03:05 +02:00
parent 7eb0eb6c59
commit 965540d3dc
2 changed files with 3 additions and 3 deletions

View File

@@ -82,7 +82,7 @@ class AstromicFormController extends FormController {
/// Prepare a hosted value. /// Prepare a hosted value.
void prepareValue<T>(String id, bool isRequired) { 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. /// Set the value of a hosted state variable using it's ID.

View File

@@ -61,7 +61,7 @@ class _FormValueWrapperState<T> extends State<FormValueWrapper<T>> {
//s1 --State //s1 --State
// //
//s1 --Controllers & Listeners //s1 --Controllers & Listeners
widget.controller.prepareValue(widget.id, widget.isRequired); widget.controller.prepareValue<T>(widget.id, widget.isRequired);
//s1 --Controllers & Listeners //s1 --Controllers & Listeners
// //
//s1 --Late & Async Initializers //s1 --Late & Async Initializers
@@ -108,7 +108,7 @@ class _FormValueWrapperState<T> extends State<FormValueWrapper<T>> {
return StreamBuilder<(String, bool)>( return StreamBuilder<(String, bool)>(
stream: widget.controller.hostedValueValidationStream, stream: widget.controller.hostedValueValidationStream,
builder: (BuildContext context, AsyncSnapshot<(String, bool)> validationSnapshot) { 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) { 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));
}); });