setupHooks method
void
setupHooks()
inherited
Implementation
void setupHooks() {
var form = context.findAncestorStateOfType<AutoFormState>();
if (form == null) {
throw "No AutoForm found in widget tree";
}
form.registerField(widget);
widget.onRefresh.value = () {
if (mounted) {
setState(() {});
}
};
widget.onValueSet.add((value) {});
widget.setErrorPointer.value = (message) {
setState(() {
errorMessage = message;
});
};
if (widget.initValue.isNotEmpty) {
widget.setValue(widget.initValue);
}
if (widget.postponedTriggers.isNotEmpty) {
WidgetsBinding.instance.addPostFrameCallback((_) {
for (var t in widget.postponedTriggers) {
t();
}
widget.postponedTriggers.clear();
});
}
widget.mounted.value = true;
}