将来使用then()方法,您可以使用That。您可以将验证器方法修改为:
validator: (value) => checkUserValue(value) ? "Username already taken" : null, bool _userExist = false; checkUserValue<bool>(String user) { _doesEmailAlreadyExist(user).then((val){ if(val){ print ("UserName Already Exits"); _userExist = val; } else{ print ("UserName is Available"); _userExist = val; } }); return _userExist; }


