6
votes

I am hoping this is a simple question, but could not find the answer. In synchronous Dart code, you can do method cascades like:

var obj1 = new SomeClass()
  ..method1()
  ..method2(param1, param2)
  ..method3();

Supposed that instead, those methods return Futures for asynchronous code. So now it seems we have to do:

var obj1 = new SomeClass();

await obj1.method1();
await obj1.method2(param1, param2);
await obj1.method3();

Do method cascades work with the whole async/await constructs? If so, how?

1

1 Answers

6
votes

Looks like this is not (yet) supported. There is an open issue https://github.com/dart-lang/sdk/issues/23000