OLD | NEW |
1 --- | 1 --- |
2 layout: default | 2 layout: default |
3 title: "A Tour of the Dart Libraries" | 3 title: "A Tour of the Dart Libraries" |
4 description: "Learn how to use each major Dart library feature." | 4 description: "Learn how to use each major Dart library feature." |
5 has-permalinks: true | 5 has-permalinks: true |
6 --- | 6 --- |
7 | 7 |
8 # {{ page.title }} | 8 # {{ page.title }} |
9 | 9 |
10 Welcome to the Dart library tour! | 10 Welcome to the Dart library tour! |
(...skipping 844 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
855 | 855 |
856 Sometimes your algorithm needs to initiate many asynchronous methods | 856 Sometimes your algorithm needs to initiate many asynchronous methods |
857 and wait for each one to complete before continuing. Use the Futures class | 857 and wait for each one to complete before continuing. Use the Futures class |
858 to manage multiple Futures and wait for them all to complete. | 858 to manage multiple Futures and wait for them all to complete. |
859 | 859 |
860 {% highlight dart %} | 860 {% highlight dart %} |
861 Future deleteDone = deleteLotsOfFiles(); | 861 Future deleteDone = deleteLotsOfFiles(); |
862 Future copyDone = copyLotsOfFiles(); | 862 Future copyDone = copyLotsOfFiles(); |
863 Future checksumDone = checksumLotsOfOtherFiles(); | 863 Future checksumDone = checksumLotsOfOtherFiles(); |
864 | 864 |
865 Futures.join([deleteDone, copyDone, checksumDone]).then(() { | 865 Futures.wait([deleteDone, copyDone, checksumDone]).then((List values) { |
866 print('Done with all the long steps'); | 866 print('Done with all the long steps'); |
867 }); | 867 }); |
868 {% endhighlight %} | 868 {% endhighlight %} |
869 | 869 |
870 #### More information | 870 #### More information |
871 | 871 |
872 Refer to the API docs for | 872 Refer to the API docs for |
873 [Future](http://api.dartlang.org/dart_core/Future.html), | 873 [Future](http://api.dartlang.org/dart_core/Future.html), |
874 [Futures](http://api.dartlang.org/dart_core/Futures.html), and | 874 [Futures](http://api.dartlang.org/dart_core/Futures.html), and |
875 [Completer](http://api.dartlang.org/dart_core/Completer.html) | 875 [Completer](http://api.dartlang.org/dart_core/Completer.html) |
(...skipping 804 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1680 assert(base64 == | 1680 assert(base64 == |
1681 "iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38G" | 1681 "iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38G" |
1682 "IAXDIBKE0DHxgljNBAAO9TXL0Y4OHwAAAABJRU5ErkJggg=="); | 1682 "IAXDIBKE0DHxgljNBAAO9TXL0Y4OHwAAAABJRU5ErkJggg=="); |
1683 } | 1683 } |
1684 {% endhighlight %} | 1684 {% endhighlight %} |
1685 | 1685 |
1686 [Back to contents.](#toc) | 1686 [Back to contents.](#toc) |
1687 {:.up-to-toc} | 1687 {:.up-to-toc} |
1688 | 1688 |
1689 | 1689 |
OLD | NEW |