Exceptions in Dart
Exceptions are used to handle errors that occur during the execution of a program. In Dart, exceptions are handled using try-catch statements.
void main() {
try {
var result = 5 ~/ 0;
print(result);
} catch (e) {
print('Error: $e');
} finally {
print('Done');
}
}
No comments:
Post a Comment