OLD | NEW |
1 --- | 1 --- |
2 layout: book | 2 layout: book |
3 title: "A Tour of the Dart Libraries" | 3 title: "A Tour of the Dart Libraries" |
4 subsite: "Dart Up and Running" | 4 subsite: "Dart Up and Running" |
5 description: "Read Chapter 3, A Tour of the Dart Libraries (from Dart: Up and Ru
nning, published by O'Reilly)." | 5 description: "Read Chapter 3, A Tour of the Dart Libraries (from Dart: Up and Ru
nning, published by O'Reilly)." |
6 prev-chapter: ch02.html | 6 prev-chapter: ch02.html |
7 prev-chapter-title: "Language Tour" | 7 prev-chapter-title: "Language Tour" |
8 next-chapter: ch04.html | 8 next-chapter: ch04.html |
9 next-chapter-title: "Tools" | 9 next-chapter-title: "Tools" |
10 --- | 10 --- |
(...skipping 949 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
960 | 960 |
961 Throwing an application-specific exception is a common way to indicate | 961 Throwing an application-specific exception is a common way to indicate |
962 that an error has occurred. You can define a custom exception by | 962 that an error has occurred. You can define a custom exception by |
963 implementing the Exception interface: | 963 implementing the Exception interface: |
964 | 964 |
965 <!-- ch03/exceptions.dart --> | 965 <!-- ch03/exceptions.dart --> |
966 {% prettify dart %} | 966 {% prettify dart %} |
967 class FooException implements Exception { | 967 class FooException implements Exception { |
968 final String msg; | 968 final String msg; |
969 const FooException([this.msg]); | 969 const FooException([this.msg]); |
970 String toString() => msg == null ? 'FooException' : msg; | 970 String toString() => msg ?? 'FooException'; |
971 } | 971 } |
972 {% endprettify %} | 972 {% endprettify %} |
973 | 973 |
974 For more information, see [Exceptions](#exceptions) and the [Exception API | 974 For more information, see [Exceptions](#exceptions) and the [Exception API |
975 docs.](http://api.dartlang.org/dart_core/Exception.html) | 975 docs.](http://api.dartlang.org/dart_core/Exception.html) |
976 | 976 |
977 | 977 |
978 ## dart:async - asynchronous programming {#dartasync---asynchronous-programming} | 978 ## dart:async - asynchronous programming {#dartasync---asynchronous-programming} |
979 | 979 |
980 Asynchronous programming often uses callback functions, but Dart | 980 Asynchronous programming often uses callback functions, but Dart |
(...skipping 1815 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2796 can get yet more libraries by using the pub tool, discussed in the next | 2796 can get yet more libraries by using the pub tool, discussed in the next |
2797 chapter. The [args,](https://pub.dartlang.org/packages/args) | 2797 chapter. The [args,](https://pub.dartlang.org/packages/args) |
2798 [logging,](https://pub.dartlang.org/packages/logging) | 2798 [logging,](https://pub.dartlang.org/packages/logging) |
2799 [polymer,](https://pub.dartlang.org/packages/polymer) and | 2799 [polymer,](https://pub.dartlang.org/packages/polymer) and |
2800 [test](https://pub.dartlang.org/packages/test) libraries are just a | 2800 [test](https://pub.dartlang.org/packages/test) libraries are just a |
2801 sampling of what you can install using pub. | 2801 sampling of what you can install using pub. |
2802 | 2802 |
2803 | 2803 |
2804 <hr> | 2804 <hr> |
2805 {% include book-nav.html %} | 2805 {% include book-nav.html %} |
OLD | NEW |