user3166024
user3166024

Reputation: 179

Can 'await' be used inside Future.delayed?

 Future.delayed(duration, () async {
      await aFunction();
    });

This is what i tried but it didn't work. I want to run an await function after a duration delay. Thanks for any help.

Upvotes: 0

Views: 187

Answers (1)

fartem
fartem

Reputation: 2531

You should to await delayed future:

await Future.delayed(delay, () async => await aFunction());

Upvotes: 2

Related Questions