Assign RxCommand on validator TextFormField
mrangelba opened this issue · 1 comments
Error message "The argument type 'RxCommand<String, String>' can't be assigned to the parameter type '(String) → String'."
TextFormField( decoration: InputDecoration( hintText: "Título", labelText: "Informe o título da marca"), initialValue: snapshot.data.brand.title, validator: bloc.textTitleValidatorCommand, )
RxCommand<String, String> textTitleValidatorCommand = RxCommand.createSync<String, String>(_actionTextTitleValidator);
String _actionTextTitleValidator(String value) { if (value.isEmpty) { return 'Please enter titlte'; } return null; }
You cannot use an RxCommand as a Validator in a Textformfield. a Validator has to be a function that returns String or null. Calling an RxCommand doesn't return anything