My question is, will that mean that the first 3 functions will be executed at the same time and then when the others run, they will also be at the same time?
It depends on exactly what you mean by "at the same time". When you do:
void main() {
api1();
api2();
api3();
}
and if api1
, api2
, and api3
are all asynchronous, then they will run concurrently. They might or might not run in parallel.
Note that if api1
, api2
, and api3
each returns a Future
, then none of those Future
s are await
ed and you will not be notified when any or all of them complete. If you want to be notified when all of them complete, then use Future.wait
. If you don't care and want to treat them as fire-and-forget operations, then Future.wait
isn't necessary.
If you also want to silently swallow errors from api1
, api2
, and api3
, then you should use the Future.ignore
extension method:
void main() {
api1().ignore();
api2().ignore();
api3().ignore();
}