This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
try { | |
final _ = 100 ~/ 0; | |
} on IntegerDivisionByZeroException { | |
print('Cant divide to zero'); | |
} finally { | |
print('Clean-up done 1'); | |
} | |
print('\n\n'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
try { | |
Future.delayed(Duration(seconds: 1), () { | |
final _ = 100 ~/ 0; | |
}); | |
print('Everything is fine!'); | |
} on IntegerDivisionByZeroException { | |
print('Cant divide to zero'); | |
} finally { | |
print('Clean-up done'); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
try { | |
await Future.delayed(Duration(seconds: 1), () { | |
final _ = 100 ~/ 0; | |
}); | |
print('Everything is fine!'); | |
} on IntegerDivisionByZeroException { | |
print('Cant divide to zero'); | |
} finally { | |
print('Clean-up done'); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
try { | |
await Future.delayed(Duration(seconds: 1), () { | |
print('Its ok so far'); | |
}).then((value) { | |
final _ = 100 ~/ 0; | |
}); | |
print('Everything is fine!'); | |
} on IntegerDivisionByZeroException { | |
print('Cant divide to zero'); | |
} finally { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
await Future.delayed(Duration(seconds: 1), () { | |
print('Its ok so far'); | |
}).then((value) { | |
final _ = 100 ~/ 0; | |
}).catchError((error) { | |
print('Cant divide to zero'); | |
}).whenComplete(() { | |
print('Clean-up done'); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
await Future.delayed(Duration(seconds: 1), () { | |
print('Its ok so far'); | |
}).then((value) { | |
final _ = 100 ~/ 0; | |
}).catchError((error) { | |
print('Cant divide to zero'); | |
}).whenComplete(() { | |
print('Clean-up done'); | |
throw 'ss'; | |
}).catchError((error) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
await Future.delayed(Duration(seconds: 1), () { | |
print('Its fie so far'); | |
}).then((value) { | |
print('Then started'); | |
throw 'random exception'; | |
}).catchError((error) { | |
print('Cant divide to zero'); | |
}, test: (e) => e is IntegerDivisionByZeroException).catchError((error) { | |
print('All other exceptions: $error'); | |
}, test: (e) => true).whenComplete(() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
try { | |
await Future.delayed(Duration(seconds: 1), () { | |
print('Its fie so far'); | |
}); | |
await Future(() { | |
print('Then started'); | |
throw 'random exception'; | |
}); | |
} on IntegerDivisionByZeroException { | |
print('Cant divide to zero'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
try { | |
Timer.run(() { | |
print('Timer runs.'); | |
throw Exception('[Timer] Bad thing happens!'); | |
}); | |
print('Everything is fine!'); | |
} on IntegerDivisionByZeroException { | |
print('Cant divide to zero'); | |
} finally { | |
print('Clean-up done'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
runZonedGuarded((){ | |
Timer.run(() { | |
print('Timer runs.'); | |
throw Exception('[Timer] Bad thing happens!'); | |
}); | |
print('Everything is fine!'); | |
}, (e,s) { | |
print('Exception handled $e, \n$s'); | |
}); |
OlderNewer