- The value is set using setState and it shows up on the screen, but when _formKey.currentState.validate() si triggered the value in validator:(value){} is null.
The checking of value should be: if(value==null || value=='') return 'This field is required';
If the widget receives a new value it should call setState on it's new value and handle it internal so that the value that the validator receives is not null.
I will try to research this and help you, but in the mean time this is still an issue.
The problem seems to be here:
value: value == '' ? null : value,
onChanged: (dynamic newValue) {
state.didChange(newValue);
validator(newValue);
onChanged(newValue);
},
At first the value is '' but after I set the value to something it becomes 'something' but the onChangeMethod is not triggered with the newValue.
We have to find a way to force that trigger.