onChange method
view
is a String that will be displayed
to a user. This must be null for text inputs
since they are updated on user input but for
other inputs e.g. a LiteDatePicker this must be a
formatted date representation
Implementation
void onChange(
dynamic value, [
bool isInitialValue = false,
String? view,
]) {
_value = value;
if (value != null) {
_isInitiallySet = true;
if (isInitialValue) {
/// Some fields might have a preprocessor
/// e.g. [LitePhoneInputField]
if (preprocessor != null) {
try {
_value = preprocessor!.preprocess(value);
} catch (e) {}
view = preprocessor?.view;
}
WidgetsBinding.instance.addPostFrameCallback((timeStamp) {
try {
textEditingController?.text = view ?? _value.toString();
} catch (e) {}
});
} else {
if (view != null) {
textEditingController?.text = view;
}
}
}
if (_isSelfValidating && !isInitialValue) {
_checkError().then((value) {
return _parent?._validateNativeForm();
});
}
}