My function is as follows:
void function() async {
…
}
I used the above function in Widget build(BuildContext context)
.
Actually, I want it to be Future<void> function() async
instead of void function() async
.
However, I can't use await
in Widget build(BuildContext context)
, so I can't use Future<void> function() async
because Future
requires await
.
I shouldn't use FutureBuilder
or then
because I don't want to get the data in the function, I just want to run the function.
Appreciate if someone can advise. Thank you in advance!