I want to write a functions which returns until an upload has been finished. If it is possible it would be good if I could also add a timeout.

```
 waitForUpload() async {
     uploader.result.listen((result) {
        // return waitForUpload
     }
 }

```

I just don't find how to write this in dart. To make it more clear: In JS the code would look like this: 

```
async waitForUpload() {
  return new Promise((resolve) => {
    uploader.result.listen((result) {
        resolve();
    });
  });
} 

```