Created
March 2, 2021 06:51
-
-
Save madmag77/3defca3408ec2427612562da74323aad to your computer and use it in GitHub Desktop.
[Dart article] Async code exceptions 6
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(() { | |
print('Clean-up done'); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment