This question is quite similar to this but the explanation didn\'t quite help for my use-case. I have a method of type Future that return a bool performing a query to cloud
The return type returned from doesNameAlreadyExist
is Future
,
so the line doesNameAlreadyExist("userName", usernameController.value) == true
,
is actually Future
.
You need to await, or then the result.
doesNameAlreadyExist("userName", usernameController.value).then(value => value == true)
or
(await doesNameAlreadyExist("userName", usernameController.value)) == true
Read more about async programming here: Dart Futures