Finally
// To ensure that some code runs whether or not an exception is thrown
try {
cookFood();
} catch (e) {
print('Error: $e'); // Handle the exception first.
} finally {
cleanKitchen(); // Then clean up.
}
Comments
// To ensure that some code runs whether or not an exception is thrown
try {
cookFood();
} catch (e) {
print('Error: $e'); // Handle the exception first.
} finally {
cleanKitchen(); // Then clean up.
}