June 2017
Intermediate to advanced
873 pages
18h 9m
English
Often, a program generates an uncaught exception and terminates the execution. The commonly occurring exceptions in the program means that the code is broken and must be fixed. However, sometimes exceptions may happen due to errors in communication, hardware faults, and so on. The following is an example of the HTTP server, which is used to demonstrate this problem:
import 'dart:io';
main() {
runServer();
}
runServer() {
HttpServer
.bind(InternetAddress.ANY_IP_V4, 8080)
.then((server) {
server.listen((HttpRequest request) {
request.response.write('Hello, world!');
request.response.close();
});
});
}The code in the main function can be terminated due to uncaught errors that may happen in the runServer function. Termination of the program under ...
Read now
Unlock full access