Exceptions

Your Dart code can throw and catch exceptions. Exceptions are errorsindicating that something unexpected happened. If the exception isn’tcaught, the isolate that raised the exception is suspended, andtypically the isolate and its program are terminated.

In contrast to Java, all of Dart’s exceptions are unchecked exceptions.Methods do not declare which exceptions they might throw, and you arenot required to catch any exceptions.

Dart provides Exception and Errortypes, as well as numerous predefined subtypes. You can, of course,define your own exceptions. However, Dart programs can throw anynon-null object—not just Exception and Error objects—as an exception.