In this code :
TextFormField(
.
.
.
validator: (value) => doFancy();
),
Where doFancy() is declared as :
Future<something> doFancy() async{...
How can I call doFancy()
inside the validator
of a TextFormField
since it's a Future
function and I can't declare the validator
as async
?
EDIT :
This is the best that I reached but I still have the same issue The argument type 'Future<String> Function(String)' can't be assigned to the parameter type 'String Function(String)'
.
validator: (value) async {
return (await checkMissingId(value, context) == false)
? "Username already taken"
: null;
},